Cisco Support Tools 1.0 User Guide How to Use the Grep Utility 229
-l: print the name of each file that has a match.
Note: Options m, v, c and l are exclusive. Only one of these may be selected.
-i: ignore the case of each character while matching.
-n: print the line number that the match occurred on.
-f: print the full pathname of the file when printing filenames.
-s: do not report errors encountered while opening or reading files.
-e: use the next argument as the pattern to search for. This is useful if the pattern
begins with a - or / character.
-?: Display program description.
The specified pattern is treated as a regular expression -- if all you need is a literal
expression, you may want to use fgrep instead. The actual regular expression syntax
is fairly standard, but escape sequence issues can complicate it. Here's an example
of the 'pristine' syntax seen internally:
^a.b+c*(d|e)?[^f]\*"$
means "in beginning-of-line context, match 'a', then an arbitrary character, then one
or more 'b's, then zero or more 'c's, then one of 'd', 'e', or nothing, then any
character but 'f', then a literal '*' character, then a double-quote character, in end-
of-line context."
The first added complication is the Picnix command-line argument parser, which has
special semantics for ", ', `, @, $, and ^. So the argument as seen by this parser
would have to be:
^^a.b+c*(d|e)?[^^f]\*^"$
The second added complication is that you may be executing grep through an
additional shell, such as the WinNT cmd.exe, which has special semantics for |, ^, ",
and \, and for which you should actually put this on the command line or in your
batch file:
"^^a.b+c*(d|e)?[^^f]\*^"$"
Or you may be executing grep through a build tool like pmake.exe, for which you'd
have to say:
"^^^^a.b+c*(d|e)?[^^^^f]\*^^"$$"
Note: If the environment variable Grep exists, its value is used to establish default
options.
Note: You can override an option that was specified in the environment variable by
following the option with a minus '-' sign. For example, to turn off the -i option,
specify -i-.