grep Command grep Pattern search grep [option ...] [pattern] [file ...] grep searches each file for occurrences of the pattern (sometimes called a regular expression). If no file is specified, grep searches the standard input. The pattern is given in the same manner as to ed. Normally, grep prints each line matching the pattern. The following options are available. -b With each output line, print the block number in which the line started (used to search file systems). -c Print the count of matching lines rather than the lines. -e The next argument is pattern (useful if the pattern starts with `-'). -f The next argument is a file containing a list of patterns separated by newlines; there is no pattern argument. -h When more than one file is specified, output lines are norm- ally accompanied by the file name; -h suppresses this. -l Print the name of each file containing matching lines rather than the lines. -n The line number in the file accompanies each line printed. -s Suppress all output, just return status. -v Print a line if the pattern is not found in the line. -x Print the line only if it is exactly the same as the pattern; treat wildcards in the pattern as plain text. -y Lower-case letters in the pattern match lower-case and upper- case letters on the input lines. ***** See Also ***** awk, commands, ed, egrep, expr, lex, sed ***** Diagnostics ***** grep returns an exit status of zero for success, one for no matches, two for error. ***** Notes ***** egrep is an extended and faster version of grep. COHERENT Lexicon Page 1