Chapter 14: Using 3rd Party Common Tools

grep

Step 2 Specify the command duration time or accept the default (60 seconds). This is the amount of time the command will attempt to run before terminating.

Step 3 If desired, check Elevate Command Priority. This ensures the command will run regardless of the level of server activity.

Step 4 Click the Run button.

Using Grep - Command Line Options

grep [ -mvclinfse? ] <pattern> file1 ...

The options for Grep are:

-m: print the lines that match the pattern (DEFAULT).

-v: print the lines that DON'T match the pattern.

-c: print a count of the number of matching lines in each file.

-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:

Cisco Support Tools User Guide for Cisco Unified Software Release 2.1(1)

211

Page 225
Image 225
Cisco Systems 2.1(1) manual Using Grep Command Line Options, 211