egrep und regexps
Nachdem ich das immer wieder vergesse und perl nicht immer die erste Wahl sein kann, ein paar Erinnerungshilfen zu egrep:
[:alpha:] Any alphabetic character [:lower:] Any lowercase character [:upper:] Any uppercase character [:digit:] Any digit [:alnum:] Any alphanumeric character (alphabetic or digit) [:space:] Any white space character (space, tab, vertical tab) [:graph:] Any printable character, except space [:print:] Any printable character, including the space [:punct:] Any punctuation (i.e., a printable character that ... [:cntrl:] Any nonprintable character
character matches . Any character \. A period $ End of line \$ A dollar sign * Zero or more occurrences of the preceding expression \* An asterisk \ Nothing -- is an escape character \\ A backslash | Create an "or" branch between two expressions \| A vertical bar
Und dann noch ein kurzer Vergleich zwischen grep und egrep:
egrep grep meaning [a-z]{2,4} [a-z]\{2,4\} Two through four characters [a-z]{4} [a-z]\{4\} Exactly four characters [a-z]{4,} [a-z]\{4,\} Four or more characters [a-z]{,4} [a-z]\{,4\} Zero through four characters
(Quelle: http://www.manucomp.com/solaris_tips/using_grep_command_egrep.html)