You can use the vertical bar
(|) with any
show command and include a filter option and
filtering expression. The filtering is performed by matching each output line
with a regular expression, similar to Cisco IOS software. By selecting
different filter options you can include or exclude all output that matches the
expression. You can also display all output beginning with the line that
matches the expression.
The syntax for using
filtering options with the
show command is as follows:
show
command
| {include|
exclude
|
begin |
grep
[-v]}
regexp
or
more
system:running-config| {include|
exclude
|
begin |
grep
[-v]}
regexp
 Note |
Entering the
more command allows you to view the
contents of any file, not just the running configuration; see the command
reference for more information.
|
In this command string, the first vertical bar (|) is the
operator and must be included in the command. This operator directs the output
of the
show command to the filter. In the syntax
diagram, the other vertical bars (|) indicate alternative options and are not
part of the command.
The
include option includes all output lines that
match the regular expression. The
grep option without
-v has the same effect. The
exclude option excludes all output lines that
match the regular expression. The
grep option with-v
has the same effect. The
begin option shows all the output lines
starting with the line that matches the regular expression.
Replace
regexp with any Cisco IOS regular expression.
The regular expression is not enclosed in quotes or double-quotes, so be
careful with trailing white spaces, which will be taken as part of the regular
expression.
When creating regular expressions, you can use any letter or
number that you want to match. In addition, certain keyboard characters called
metacharacters have special meaning when used in regular
expressions.
Use
Ctrl+V
to escape all of the special characters in the CLI, such as a
question mark (?) or a tab. For example, type
d[Ctrl+V]?g
to enter d?g in the configuration.