
grep(1) |
|
|
| grep(1) |
NAME |
|
|
|
|
grep, egrep, fgrep - search a ®le for a pattern |
|
| ||
SYNOPSIS |
|
|
|
|
Plain call with pattern |
|
|
| |
grep | pattern [ ®le | ... ] | ||
Call with (multiple) −e pattern |
|
| ||
grep | ||||
Call with −f ®le |
|
|
|
|
grep |
Obsolescent:
egrep
fgrep
DESCRIPTION
The grep command searches the input text ®les (standard input default) for lines matching a pattern. Normally, each line found is copied to the standard output. grep supports the Basic Regular Expression syntax (see regexp(5)). The
The forms egrep and fgrep are maintained for backward compatibility. The use of the
Options | Extended regular expressions. Each pattern speci®ed is a sequence of one or | ||
| more EREs. The EREs can be separated by newline characters or given in | ||
| separate | ||
| the sequence matches the contents of the input line without its trailing newline | ||
| character. The same functionality is obtained by using egrep. |
| |
Fixed strings. Each | pattern speci®ed is a sequence of one | or more strings. | |
| Strings can be separated by newline characters or given in separate | ||
| sion options. A pattern matches an input line if the line contains any of the | ||
| strings in the sequence. The same functionality is obtained by using fgrep. | ||
Each line is preceded by the block number on which it was found. This is useful | |||
| in locating disk block numbers by context. Block numbers are calculated by | ||
| dividing by 512 the number of bytes that have been read from the ®le and round- | ||
| ing down the result. |
|
|
Only a count of matching lines is printed. |
| ||
Same as a simple expression argument, but useful when the expression begins | |||
| with a hyphen | ||
| an input line is selected if it matches any of the speci®ed patterns. | ||
The regular expression (grep and grep | |||
| from the pattern_ ®le. |
|
|
Suppress printing of ®lenames when searching multiple ®les. |
| ||
Ignore uppercase/lowercase distinctions during comparisons. |
| ||
Only the names of ®les with matching lines are listed (once), separated by new- | |||
| lines. If standard input is searched, a path name of (standard input) will | ||
| be written, in the POSIX locale. In other locales, (standard | input) may be | |
| replaced by something more appropriate in those locales. |
| |
Each line is preceded by its relative line number in the ®le starting at 1. The | |||
| line number is reset for each ®le searched. This option is ignored if | ||
| or |
|
|
− 1 − | Section 1−339 |
g