Revision c460940c0d38d512ef6dc4ba90e86de9013cd1a4 authored by Bill Joy on 21 April 1979, 08:44:49 UTC, committed by Bill Joy on 21 April 1979, 08:44:49 UTC
Work on file misc/fetchi.sys

Synthesized-from: 2bsd
1 parent 1dc6258
Raw File
grep.u
.TH GREP UCB 2/24/79 UCB
.SH NAME
grep \- search a file for a pattern
.SH SYNOPSIS
.B grep
[
.B \-v
] [
.B \-b
] [
.B \-c
] [
.B \-n
] [
.B \-l
] [
.B \-i
] [
.B \-w
] expression [ file ] ...
.SH DESCRIPTION
.I 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
.B \-v
flag is used,
all lines but those matching
are printed.
If the
.B \-c
flag is used,
only a count of matching lines is printed.
If the
.B \-l
flag is used,
only names of files which contain matching lines are printed.
If the
.B \-i
flag is used, then case of letters is ignored in comparisons.
If the
.B \-w
flag is used, then the expression is searched for as a word
(as if surrounded by `\e<' and `\e>',
see
.IR ex (UCB))
If the
.B \-n
flag is used,
each line is preceded
its relative line number in the file.
If the
.B \-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.
.PP
In all cases the file name is shown if there is more than one input file.
.PP
For a complete description
of the regular expressions,
see
.IR ex (UCB).
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
.I expression
argument in quotes.
.SH "SEE ALSO"
ex(UCB)
.SH BUGS
Lines
are limited to 256 characters;
longer lines are truncated.
back to top