Tuesday, March 4, 2008

Usage of grep

grep [OPTION] PATTERN [FILE]

Example:
Count for lines contain numbers:
grep -E '[0-9]+' -c filename

-E means extended regular expression
-c means to print a count of matching lines per file, otherwise it will print all suitable lines.

No comments: