PWB1/usr/man/man1/grep.1

Compare this file to the similar file:
Show the results in this format:

.th GREP I 5/31/77
.sh NAME
grep \*- search a file for a pattern
.sh SYNOPSIS
.bd grep
[
.bd \*-v
] [
.bd \*-b
] [
.bd \*-c
] [
.bd \*-n
] [
.bd \*-s
] expression [ file ] ...
.sh DESCRIPTION
.it Grep
searches the input files
(standard input default)
for lines matching the
regular expression.
Normally, each line found
is copied to the standard output.
If the
.bd \*-v
flag is used,
all lines but those matching
are printed.
If the
.bd \*-c
flag is used,
only a count of matching lines is printed.
If the
.bd \*-n
flag is used,
each line is preceded by
its relative line number in the file.
If the
.bd \*-b
flag is used,
each line is preceded by the block number
on which it was found.
This is sometimes useful in locating
disk block numbers by context.
.s3
The
.bd \*-s
flag suppresses the error messages that
.it grep
would otherwise give for non-existent (or unreadable) files.
.s3
In all cases the file name is shown if there is more than one input file.
.s3
For a complete description
of the regular expression,
see
.it ed\^\c
(I).
Care should be taken when
using the characters
$ * [ ^ | ( ) and \\ in the
.it expression,
as they are
also meaningful to the Shell.
It is generally necessary to enclose the
entire
.it expression
argument in quotes.
.sh "SEE ALSO"
ed(I), egrep(I), fgrep(I), rgrep(I), sed(I), sh(I)
.sh BUGS
Lines
are limited to 256 characters;
longer lines are truncated.
.br
Unfortunately,
.it grep
does not recognize all of the
regular expression operators that
.it ed\^\c
(I) does.