The Wiki has moved to new hardware, and the old server died.
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howtos:general_admin:cli_constructs_and_useful_info [2012/12/24 12:08 (UTC)] hazel [Regex] |
howtos:general_admin:cli_constructs_and_useful_info [2013/04/02 15:19 (UTC)] htexmexh [Constructs] |
||
---|---|---|---|
Line 9: | Line 9: | ||
ls -1 /var/log/packages | rev | cut -d - -f 1-3 --complement | rev | ls -1 /var/log/packages | rev | cut -d - -f 1-3 --complement | rev | ||
</code> | </code> | ||
- | Or if you wanted to get the full patch of a file, minus the suffix. | + | Or if you wanted to get the full path of a file, minus the suffix. |
<code bash> | <code bash> | ||
echo /proc/config.gz | rev | cut -d. -f1 --complement | rev | echo /proc/config.gz | rev | cut -d. -f1 --complement | rev | ||
Line 174: | Line 174: | ||
* Example: ''\<[tT]he\>'' matches the word ''the'' or ''The''. | * Example: ''\<[tT]he\>'' matches the word ''the'' or ''The''. | ||
* ''*'' matches any number of the previous character or nothing = no character. Example: ''[0-9]*'' which will match any number of numbers. ''.*'' matches any number of anything. | * ''*'' matches any number of the previous character or nothing = no character. Example: ''[0-9]*'' which will match any number of numbers. ''.*'' matches any number of anything. | ||
- | === Extended === | + | === Extended regular expressions === |
The following must be supported by the program for them to work. For example for grep you must run ''egrep'' or ''grep -E''. | The following must be supported by the program for them to work. For example for grep you must run ''egrep'' or ''grep -E''. | ||
* ''+'' matches any number of the previous character, like ''*'', but there must be at least one to match, so it will not match nothing or no character. | * ''+'' matches any number of the previous character, like ''*'', but there must be at least one to match, so it will not match nothing or no character. | ||
Line 204: | Line 204: | ||
</code> | </code> | ||
=== cmp === | === cmp === | ||
- | This can compare two files byte by byte, and can be more useful that checksums. For example, after you burn a CD/DVD, you can run: | + | This can compare two files byte by byte, and can be more useful than checksums. For example, after you burn a CD/DVD, you can run: |
<code bash> | <code bash> | ||
cmp slackware.iso /dev/sr0 | cmp slackware.iso /dev/sr0 |