!!Unix / Linux search command utility
!Usage:
{{{
grep [options] regexp [file...]
Options:
-v show lines that don't match instead of lines that match
-H print file names with matches
-i ignore case
-E enable extended regular expressions
-c print count only
-l just print the names of files that have matches
-n print line numbers
-r recurse into sub-directories
}}}
!Extended regular expressions (i.e. -E). Those allowed in basic, non-extended mode too are marked with (B):
Matching characters
{{{
. match any character (B)
^ matches beginning of line (B)
$ matches end of line (B)
[abc] matches 'a', 'b', or 'c' (B)
[^abc] matches anything except 'a', 'b', or 'c' (B)
[a-e] range match, same as [abcde] (B)
[[:x:]] match pre-difned class of characters as follows: (B)
:alnum:
:alpha:
:digit:
:lower:
:upper:
:space:
\w same as [[:alnum:]]
\W same as [^[:alnum:]]
}}}
Repeating characters
{{{
* zero or more times (B)
? preceding item matched 0 or 1 time
+ one or more times
}}}
{{{
e1|e2 matches expression e1 OR e2
}}}