BSD 3 development
[unix-history] / usr / man / man1 / grep.1
index 18780de..89ba4bb 100644 (file)
@@ -1,4 +1,5 @@
-.TH GREP 1 
+.TH GREP 1 11/16/79
+.UC
 .SH NAME
 grep, egrep, fgrep \- search a file for a pattern
 .SH SYNOPSIS
 .SH NAME
 grep, egrep, fgrep \- search a file for a pattern
 .SH SYNOPSIS
@@ -24,15 +25,10 @@ family search the input
 for lines matching
 a pattern.
 Normally, each line found
 for lines matching
 a pattern.
 Normally, each line found
-is copied to the standard output;
-unless the
-.B \-h
-flag is used,
-the file name is shown if there is more than one input file.
-.PP
+is copied to the standard output.
 .I Grep
 patterns are limited regular expressions in the style of
 .I Grep
 patterns are limited regular expressions in the style of
-.IR ed (1);
+.IR ex (1);
 it uses a compact nondeterministic algorithm.
 .I Egrep
 patterns are full regular expressions;
 it uses a compact nondeterministic algorithm.
 .I Egrep
 patterns are full regular expressions;
@@ -40,13 +36,17 @@ it uses a fast deterministic algorithm that
 sometimes needs exponential space.
 .I Fgrep
 patterns are fixed strings; it is fast and compact.
 sometimes needs exponential space.
 .I Fgrep
 patterns are fixed strings; it is fast and compact.
-.PP
 The following options are recognized.
 .TP
 .B \-v
 All lines but those matching
 are printed.
 .TP
 The following options are recognized.
 .TP
 .B \-v
 All lines but those matching
 are printed.
 .TP
+.B \-x
+(Exact) only lines matched in their entirety are printed
+.RI ( fgrep
+only).
+.TP
 .B \-c
 Only a count of matching lines is printed.
 .TP
 .B \-c
 Only a count of matching lines is printed.
 .TP
@@ -56,7 +56,7 @@ separated by newlines.
 .TP
 .B \-n
 Each line is preceded by
 .TP
 .B \-n
 Each line is preceded by
-its line number in the file.
+its relative line number in the file.
 .TP
 .B \-b
 Each line is preceded by the block number
 .TP
 .B \-b
 Each line is preceded by the block number
@@ -64,17 +64,21 @@ on which it was found.
 This is sometimes useful in locating
 disk block numbers by context.
 .TP
 This is sometimes useful in locating
 disk block numbers by context.
 .TP
-.B \-s
-No output is produced, only status.
+.B \-i
+The case of letters is ignored in making comparisons.
+(E.g. upper and lower case are considered identical.)
+(\fIgrep\fR\| only)
 .TP
 .TP
-.B \-h
-Do not print filename headers with output lines.
+.B \-s
+Silent mode.
+Nothing is printed (except error messages).
+This is useful for checking the error status.
 .TP
 .TP
-.B \-y
-Lower case letters in the pattern will also match
-upper case letters in the input
-.RI ( grep
-only).
+.B \-w
+The expression is searched for as a word
+(as if surrounded by `\e<' and `\e>', see
+.IR ex (1).)
+(\fIgrep\fR\| only)
 .TP
 .BI \-e " expression"
 Same as a simple
 .TP
 .BI \-e " expression"
 Same as a simple
@@ -91,15 +95,11 @@ or string list
 .RI ( fgrep ) 
 is taken from the
 .I file.
 .RI ( fgrep ) 
 is taken from the
 .I file.
-.TP
-.B \-x
-(Exact) only lines matched in their entirety are printed
-.RI ( fgrep
-only).
 .PP
 .PP
+In all cases the file name is shown if there is more than one input file.
 Care should be taken when
 using the characters
 Care should be taken when
 using the characters
-$ * [ ^ | ? \' " ( ) and \e in the
+$ * [ ^ | ( ) and \\ in the
 .I expression
 as they are
 also meaningful to the Shell.
 .I expression
 as they are
 also meaningful to the Shell.
@@ -118,10 +118,11 @@ In the following description `character' excludes
 newline:
 .IP
 A \e followed by a single character
 newline:
 .IP
 A \e followed by a single character
+other than newline
 matches that character.
 .IP
 matches that character.
 .IP
-The character ^
-($) matches the beginning (end) of a line.
+The character ^ ($) matches the beginning (end) of
+a line.
 .IP
 A 
 .B .
 .IP
 A 
 .B .
@@ -159,7 +160,7 @@ at the same parenthesis level
 is [\|] then
 *+? then concatenation then | and newline.
 .SH "SEE ALSO"
 is [\|] then
 *+? then concatenation then | and newline.
 .SH "SEE ALSO"
-ed(1),
+ex(1),
 sed(1),
 sh(1)
 .SH DIAGNOSTICS
 sed(1),
 sh(1)
 .SH DIAGNOSTICS