grep searches the named input files
for lines containing a match to the given pattern.
grep prints the matching lines.
A file named - stands for standard input.
If no input is specified,
grep searches the working
directory . if given a command-line option specifying
grep searches standard input.
There are four major variants of
controlled by the following options.
Interpret the pattern as a basic regular expression (BRE). This is the default.
Interpret the pattern as an extended regular expression (ERE). (-E is specified by POSIX.)
Interpret the pattern as a list of fixed strings (instead of regular expressions), separated by newlines, any of which is to be matched. (-F is specified by POSIX.)
Interpret the pattern as a Perl regular expression. This is highly experimental and ‘grep -P’ may warn of unimplemented features.
two variant programs
fgrep are available.
egrep is the same as ‘grep -E’.
fgrep is the same as ‘grep -F’.
Direct invocation as either
fgrep is deprecated,
but is provided to allow historical applications
that rely on them to run unmodified.