
grep(1) |
|
|
| grep(1) |
Ken | 112 | Warring | St. Apt. A | |
Judy | 387 | Bowditch | Apt. | 12 |
Ann | 429 | Sixth St. |
| |
the command: |
|
|
| |
grep | Judy | address |
|
|
prints: |
|
|
|
|
Judy | 387 | Bowditch | Apt. | 12 |
To search a ®le for lines that contain either a Dec or Nov, use either of the following commands:
grep
Search all ®les in the current directory for the string xyz:
grep xyz *
Search all ®les in the current directory subtree for the string xyz, and ensure that no error occurs due to ®le name expansion exceeding system argument list limits:
find .
The previous example does not print the name of ®les where string xyz appears. To force grep to print ®le names, add a second argument to the grep command portion of the command line:
find .
In this form, the ®rst ®le name is that produced by find, and the second ®le name is the null ®le.
WARNINGS
(XPG4 only.) If the
If the
SEE ALSO
sed(1), sh(1), regcomp(3C), environ(5), lang(5), regexp(5).
STANDARDS CONFORMANCE
grep: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
egrep: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
fgrep: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
g
− 3 − | Section 1−341 |