-.I Grep
-searches the files listed in the arguments (or standard
-input if no files are given) for all lines that contain a match for
-the given
-.IR expr .
-If any lines match, they are printed.
-.PP
-Also, if any matches were found,
-.I grep
-exits with a status of 0, but if no matches were found it exits
-with a status of 1. This is useful for building shell scripts that
-use
-.I grep
-as a condition for, for example, the
-.I if
-statement.
-.PP
-When invoked as
-.I egrep
-the syntax of the
-.I expr
-is slightly different; See below.
-.br
-.SH "REGULAR EXPRESSIONS"
-.RS 2.5i
-.ta 1i 2i
-.sp
-.ti -2.0i
-(grep) (egrep) (explanation)
-.sp
-.ti -2.0i
-\fIc\fP \fIc\fP a single (non-meta) character matches itself.
-.sp
-.ti -2.0i
-\&. . matches any single character except newline.
-.sp
-.ti -2.0i
-\\? ? postfix operator; preceeding item is optional.
-.sp
-.ti -2.0i
-\(** \(** postfix operator; preceeding item 0 or
-more times.
-.sp
-.ti -2.0i
-\\+ + postfix operator; preceeding item 1 or
-more times.
-.sp
-.ti -2.0i
-\\| | infix operator; matches either
-argument.
-.sp
-.ti -2.0i
-^ ^ matches the empty string at the beginning of a line.
-.sp
-.ti -2.0i
-$ $ matches the empty string at the end of a line.
-.sp
-.ti -2.0i
-\\< \\< matches the empty string at the beginning of a word.
-.sp
-.ti -2.0i
-\\> \\> matches the empty string at the end of a word.
-.sp
-.ti -2.0i
-[\fIchars\fP] [\fIchars\fP] match any character in the given class; if the
-first character after [ is ^, match any character
-not in the given class; a range of characters may
-be specified by \fIfirst\-last\fP; for example, \\W
-(below) is equivalent to the class [^A\-Za\-z0\-9]
-.sp
-.ti -2.0i
-\\( \\) ( ) parentheses are used to override operator precedence.
-.sp
-.ti -2.0i
-\\\fIdigit\fP \\\fIdigit\fP \\\fIn\fP matches a repeat of the text
-matched earlier in the regexp by the subexpression inside the nth
-opening parenthesis.
-.sp
-.ti -2.0i
-\\ \\ any special character may be preceded
-by a backslash to match it literally.
-.sp
-.ti -2.0i
-(the following are for compatibility with GNU Emacs)
-.sp
-.ti -2.0i
-\\b \\b matches the empty string at the edge of a word.
-.sp
-.ti -2.0i
-\\B \\B matches the empty string if not at the edge of a word.
-.sp
-.ti -2.0i
-\\w \\w matches word-constituent characters (letters & digits).
-.sp
-.ti -2.0i
-\\W \\W matches characters that are not word-constituent.
-.RE
-.PP
-Operator precedence is (highest to lowest) ?, \(**, and +, concatenation,
-and finally |. All other constructs are syntactically identical to
-normal characters. For the truly interested, the file dfa.c describes
-(and implements) the exact grammar understood by the parser.
-.SH OPTIONS
+.PP
+.B Grep
+searches the named input
+.I files
+(or standard input if no files are named, or
+the file name
+.B \-
+is given)
+for lines containing a match to the given
+.IR pattern .
+By default,
+.B grep
+prints the matching lines.
+.PP
+There are three major variants of
+.BR grep ,
+controlled by the following options.
+.PD 0
+.TP
+.B \-G
+Interpret
+.I pattern
+as a basic regular expression (see below). This is the default.
+.TP
+.B \-E
+Interpret
+.I pattern
+as an extended regular expression (see below).
+.TP
+.B \-F
+Interpret
+.I pattern
+as a list of fixed strings, separated by newlines,
+any of which is to be matched.
+.LP
+In addition, two variant programs
+.B egrep
+and
+.B fgrep
+are available.
+.B Egrep
+is similiar (but not identical) to
+.BR "grep\ \-E" ,
+and is compatible with the historical Unix
+.BR egrep .
+.B Fgrep
+is the same as
+.BR "grep\ \-F" .
+.PD
+.LP
+All variants of
+.B grep
+understand the following options:
+.PD 0
+.TP
+.BI \- num
+Matches will be printed with
+.I num
+lines of leading and trailing context. However,
+.B grep
+will never print any given line more than once.