grep
 

Usage

grep [ options ... ] pattern-spec [ files ... ]
 

Purpose

 

Major options

-E Match using extended regular expressions. grep -E replaces the traditional egrep command.
-F Match using fixed strings. grep -F replaces the traditional fgrep command.
-e pat-list Usually, the first nonoption argument specifies the pattern(s) to match. Multiple patterns can be supplied by quoting them and separating them with newlines. In the case that the pattern starts with a minus sign, grep could get confused and treat it as an option. The -e option specifies that its argument is a pattern, even if it starts with a minus sign.
-f pat-file Read patterns from the file pat-file.
-i Ignore lettercase when doing pattern matching.
-l List the names of files that match the pattern instead of printing the matching lines.
-q Be quiet. Instead of writing lines to standard output, grep exits successfully if it matches the pattern, unsuccessfully otherwise. (We haven't discussed success/nonsuccess yet; see Section 6.2.)
-s Suppress error messages. This is often used together with -q.
-v Print lines that don't match the pattern.
 

Behavior

 

Caveats