
g
grep(1) | grep(1) |
(Quiet) Do not write anything to the standard output, regardless of matching | |
| lines. Exit with zero status upon ®nding the ®rst matching line. Overrides any |
| options that would produce output. |
Error messages produced for nonexistent or unreadable ®les are suppressed. | |
All lines but those matching are printed. | |
Select only those lines containing matches that form whole words. The test is | |
| that the matching substring must either be at the beginning of the line, or pre- |
| ceded by a |
| end of the line or followed by a |
| characters are letters, digits, and the underscore. |
(eXact) Matches are recognized only when the entire input line matches the ®xed | |
| string or regular expression. |
The ®le name is output in all the cases in which output is generated if there are more than one input ®le, unless the
EXTERNAL INFLUENCES
Environment Variables
LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_) do not specify a locale. If LANG is not speci®ed or is set to the empty string, a default of C (see lang(5)) is used.
LC_ALL determines the locale to use to override any values for locale categories speci®ed by the settings of LANG or any environment variables beginning with LC_.
LC_COLLATE determines the collating sequence used in evaluating regular expressions.
LC_CTYPE determines the interpretation of text as single byte and/or
LC_MESSAGES determines the language in which messages are displayed.
If any internationalization variable contains an invalid setting, the commands behave as if all internationalization variables are set to C. See environ(5).
International Code Set Support
RETURN VALUE
Upon completion, grep returns one of the following values:
0One or more matches found.
1No match found.
2Syntax error or inaccessible ®le (even if matches were found).
EXAMPLES
In the Bourne shell (sh(1)) the following example searches two ®les, ®nding all lines containing occurrences of any of four strings:
grep
else
fi' ®le1 ®le2
Note that the single quotes are necessary to tell grep
For the C shell (see csh(1)) the following command can be used:
grep
To search a ®le named address containing the following entries:
Section 1−340 | − 2 − |