-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*(de)?[^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*(de)?[^^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*(de)?[^^f]\*^"$"

Or you may be executing grep through a build tool like pmake.exe, for which you'd have to say:

"^^^^a.b+c*(de)?[^^^^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 -ioption, specify -i-.

Cisco Support Tools 1.0 User Guide

How to Use the Grep Utility 229

Page 229
Image 229
Cisco Systems 1.0 (1) manual +c*de?f\*$