3 grep, g \- search a file for a pattern
25 (standard input default)
26 for lines that match the
28 a regular expression as defined in
30 with the addition of a newline character as an alternative
33 with lowest precedence.
34 Normally, each line matching the pattern is `selected',
35 and each selected line is copied to the standard output.
39 Print only a count of matching lines.
43 Do not print file name tags (headers) with output lines.
46 The following argument is taken as a
48 This option makes it easy to specify patterns that
49 might confuse argument parsing, such as
53 Ignore alphabetic case distinctions. The implementation
54 folds into lower case all letters in the pattern and input before
55 interpretation. Matched lines are printed in their original form.
58 (ell) Print the names of files with selected lines; don't print the lines.
61 Print the names of files with no selected lines;
66 Mark each printed line with its line number counted in its file.
69 Produce no output, but return status.
72 Reverse: print lines that do not match the pattern.
75 The pattern argument is the name of a file containing regular
76 expressions one per line.
79 Don't buffer the output: write each output line as soon as it is discovered.
82 Output lines are tagged by file name when there is more than one
84 (To force this tagging, include
86 as a file name argument.)
88 Care should be taken when
89 using the shell metacharacters
94 it is safest to enclose the
97 .BR \&\|' \|.\|.\|.\| ' .
98 An expression starting with '*'
99 will treat the rest of the expression
100 as literal characters.
105 and forces tagging of output lines by file name.
106 If no files are listed, it searches all files matching
109 *.C *.b *.c *.h *.m *.cc *.java *.py *.tex *.ms
112 .B /usr/local/plan9/src/cmd/grep
114 .B /usr/local/plan9/bin/g
122 Exit status is null if any lines are selected,
123 or non-null when no lines are selected or an error occurs.