Send documentation comments to mdsfeedback-doc@cisco.com
1-21
Cisco MDS 9000 Family Command Reference
OL-8413-07, Cisco MDS SAN-OS Release 3.x
Chapter 1 CLI Overview
Searching and Filtering CLI Output
To filter show command output, use one of the following commands in EXEC mode:
You can enter the Ctrl-Z key combination at any time to interrupt the output and return to EXEC mode.
For example, you can enter the show running-config | begin hostname command to start the display of
the running configuration file at the line containing the hostname setting, then use Ctrl-Z when you get
to the end of the information you are interested in capturing. See the “Searching and Filtering CLI
Output Examples” section on page 1-21.
Multiple Filter Commands
Cisco MDS SAN-OS Release 2.1(1a) supports using multiple filters in the same show command output.
This means you can use a combination of the available filters to format the output of any show command.
Note The maximum number of commands allowed is four. For example, you can enter a maximum of three
filter commands or two filter commands and a redirection.
Cisco MDS SAN-OS Release 2.1(1a) also supports both filters and redirection in the same command.
Now you can apply the required filters to the output of any command, and save the output using the file
redirection. See the next section, “Searching and Filtering CLI Output Examples” section on page 1-21.
Searching and Filtering CLI Output Examples
The following is partial sample output of the show running-config | begin EXEC command. It begins
displaying unfiltered output with the first line that contain the pattern
vsan.
switch# show running-config | begin vsan
fcdomain fcid persistent vsan 1
fcdomain fcid persistent vsan 2
fcdomain fcid persistent vsan 3
fcdomain fcid persistent vsan 101
fcdomain fcid persistent vsan 102
fcdomain fcid database
vsan 1 wwn 29:00:00:05:30:00:06:ea fcid 0x680000 dynamic
vsan 1 wwn 28:0f:00:05:30:00:06:ea fcid 0x680001 dynamic
vsan 1 wwn 28:10:00:05:30:00:06:ea fcid 0x680002 dynamic
vsan 1 wwn 28:11:00:05:30:00:06:ea fcid 0x680003 dynamic
Command Purpose
switch# show any-command | exclude pattern
Displays output lines that do not contain the pattern.
switch# show any-command | include pattern
Displays output lines that contain the pattern.
switch# show any-command | include “pattern1|pattern2”
Displays output lines that contain either pattern1 or
pattern2.
Note The alternation patterns, “pattern1|pattern2”,
must appear within double quotes.
switch# show any-command | include pattern [next
number] [prev number]
Displays output lines that contain the pattern. Optionally,
using the next or prev parameter followed by a number also
displays the designated number of lines.
switch# show any-command | count number
Displays the number lines of output in the display.