V6/usr/man/man1/grep.1
.th GREP I 5/15/74
.sh NAME
grep \*- search a file for a pattern
.sh SYNOPSIS
.bd grep
[
.bd \*-v
] [
.bd \*-b
] [
.bd \*-c
] [
.bd \*-n
] 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
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
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 ed (I).
Care should be taken when
using the characters
$ * [ ^ | ( ) and \\ in the regular
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), sh (I)
.sh BUGS
Lines
are limited to 256 characters;
longer lines are truncated.