Filtering Show Command Output - Cisco XR 12000 Series Getting Started Manual

Hide thumbs Also See for XR 12000 Series:
Table of Contents

Advertisement

Displaying System Information with show Commands
--More--

Filtering show Command Output

Output from the show commands can generate a large amount of data. To display only a subset of
information, enter the "pipe" character (|) followed by a keyword (begin, include, exclude, or file) and
a regular expression.
Table 5-3
show Command Filter Options
Command
show command | begin regular-expression
show command | exclude regular-expression
show command | include regular-expression
show command | file device0:path/file
show command | utility name
In the following example, the show interface command includes only lines in which the expression
"protocol" appears:
RP/0/0/CPU0:router# show interface | include protocol
Null0 is up, line protocol is up
0 drops for unrecognized upper-level protocol
POS0/2/0/0 is administratively down, line protocol is administratively down
0 drops for unrecognized upper-level protocol
POS0/2/0/1 is administratively down, line protocol is administratively down
0 drops for unrecognized upper-level protocol
POS0/2/0/2 is administratively down, line protocol is administratively down
0 drops for unrecognized upper-level protocol
POS0/2/0/3 is administratively down, line protocol is administratively down
Cisco IOS XR Getting Started Guide for the Cisco XR 12000 Series Router
5-102
Table 5-3
shows the filtering options for the show command.
Description
Begins unfiltered output of the show command with the first line that
contains the regular expression.
Displays output lines that do not contain the regular expression.
Displays output lines that contain the regular expression.
Saves output of the show command to the specified file on the specified
device.
Displays a set of UNIX utilities:
cut—Cuts characters or lines from the output displayed from standard
input or a file.
egrep—Searches a file using full regular expressions.
fgrep—Searches a file for a fixed character string.
head—Copies bytes or lines at the beginning of the output displayed
from standard input or a file.
less—Displays the output of a file in a page-by-page manner.
sort—Sorts, merges, or sequence-checks the output displayed from
standard input or a file.
tail—Copies the end portion of the output displayed from standard
input or a file.
uniq—Displays or removes repeated lines in a file.
wc—Count words, lines, or bytes in a file.
xargs—Invokes a program from one or more argument lists.
Chapter 5
CLI Tips, Techniques, and Shortcuts
OL-24755-01

Advertisement

Table of Contents
loading

Table of Contents