Cisco Systems 6500 Using the CLI String Search, Regular Expressions, Single-Character Patterns

Models: 6500

1 160
Download 160 pages 24.26 Kb
Page 21
Image 21
Using the CLI String Search

Chapter 1 Command-Line Interface

Using the CLI String Search

Using the CLI String Search

The pattern in the command output is referred to as a string. The CLI string search feature allows you to search or filter any show or more command output and allows you to search and filter at --More-- prompts. This feature is useful when you need to sort though large amounts of output, or if you want to exclude output that you do not need to see.

With the search function, you can begin unfiltered output at the first line that contains a regular expression that you specify. You can then specify a maximum of one filter per command or start a new search from the --More-- prompt.

A regular expression is a pattern (a phrase, number, or more complex pattern) that software uses to match against show or more command output. Regular expressions are case sensitive and allow for complex matching requirements. Examples of simple regular expressions are Serial, misses, and 138. Examples of complex regular expressions are 00210..., ( is ), and [Oo]utput.

You can perform three types of filtering:

Use the begin keyword to begin output with the line that contains a specified regular expression.

Use the include keyword to include output lines that contain a specified regular expression.

Use the exclude keyword to exclude output lines that contain a specified regular expression. You can then search this filtered output at the --More-- prompts.

Note The CLI string search function does not allow you to search or filter backward through previous output; filtering cannot be specified using HTTP access to the CLI.

Regular Expressions

A regular expression can be a single character that matches the same single character in the command output or multiple characters that match the same multiple characters in the command output. This section describes how to create both single-character patterns and multiple-character patterns and how to create more complex regular expressions using multipliers, alternation, anchoring, and parentheses.

Single-Character Patterns

The simplest regular expression is a single character that matches the same single character in the command output. You can use any letter (A-Z, a-z) or digit (0-9) as a single-character pattern. You can also use other keyboard characters (such as ! or ~) as single-character patterns, but certain keyboard characters have special meaning when used in regular expressions. Table 1-4lists the keyboard characters with special meaning.

Table 1-4 Characters with Special Meaning

 

 

Character
Special Meaning

 

 

 

 

 

.

Matches any single character, including white space.

 

 

 

 

*

Matches 0 or more sequences of the pattern.

 

 

 

 

+

Matches 1 or more sequences of the pattern.

 

 

 

 

?

Matches 0 or 1 occurrences of the pattern.

 

 

 

 

 

 

 

 

 

 

Catalyst 6500 Series Switch SSL Services Module Command Reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

OL-9105-01

 

 

1-7

 

 

 

 

 

Page 21
Image 21
Cisco Systems 6500 manual Using the CLI String Search, Regular Expressions, Single-Character Patterns, Special Meaning