-h: suppress file names in output
-w: restrict search to whole words only
-c: displays count of matching lines in each file, not the lines themselves
(note this is not the same as $ grep index *.rb | wc -l)
-i: ignore case
-l: list only file names containing matching lines
-n: precede each line with the line number where it was found
-v: display all lines NOT matching pattern
-C: Display NUM lines of context either side of matches
-B: Display NUM lines of context Before the matches
-A: Display NUM lines of context After the matches
-e pattern:
Search for a pattern. Can use multiple times on a line
-r: Search recursively from the current or specificed directory
--include=pattern:
Only search in file names matching pattern
--exclude=pattern:
Do not search in file names matching pattern
Wednesday, July 25, 2012
Most useful grep Options
Labels:
AIX,
grep,
Scripting,
Shell,
Unix / Linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment