First page Back Continue Last page Graphics
Matching Regular Expressions
grep is a filter, and can easily be used with stdin:
echo <a string> | grep [options] <reg exp>
Some useful options (there are more) include:
- -c count occurrences only
- -E extended patterns (egrep)
- -i ignore case distinctions
- -n include line numbers
- -q quiet; no output to stdout or stderr
- -r recursive; search all subfolders
- -v select only lines not matching
- -w match "words" only (be careful: what constitutes a word?)