grep – search a file for a pattern|
grep [ –bchiILlnsv ] [ –e ] pattern | –f patternfile [ file ... ]|
Grep searches the input files (standard input default) for lines
that match the pattern, a regular expression as defined in regexp(6)
with the addition of a newline character as an alternative (substitute
for |) with lowest precedence. Normally, each line matching the
pattern is `selected', and each selected line is copied to
the standard output. The options are|
–c Print only a count of matching lines.
–h Do not print file name tags (headers) with output lines.
–e The following argument is taken as a pattern. This option makes it easy to specify patterns that might confuse argument parsing, such as –n.
–i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpretation. Matched lines are printed in their original form.
–I Ignore Unicode variations; use base codepoint. The implementation folds all letters in the pattern and input into their base codepoint before interpretation. Matched lines are printed in their original form. This may be combined with –i.
–l (ell) Print the names of files with selected lines; don't print the lines.
–L Print the names of files with no selected lines; the converse of –l.
–n Mark each printed line with its line number counted in its file.
–s Produce no output, but return status.
–v Reverse: print lines that do not match the pattern.
–f The pattern argument is the name of a file containing regular expressions one per line.
–b Don't buffer the output: write each output line as soon as it is discovered.
ed(1), awk(1), sed(1), sam(1), regexp(6)|
Exit status is null if any lines are selected, or non–null when
no lines are selected or an error occurs.|