Filtering the Output of Show Commands

The output from many show commands can be long and complicated, sometimes containing more information than you need at a given time.

The filter output display feature allows you to extract the output information from a show command that fits your needs.

The feature is a restricted version of a UNIX/Linux feature that uses a "pipe" character to direct the output of one command to be used as input for the next command.

It provides support for “piping” show command output to the display filter using the vertical bar (|) operator. (In the following command, it is the first vertical bar.) The display filter displays the output based on the specified filter keyword option and the text pattern entered. By selecting different filter options you can include or exclude all output that matches the pattern. You can also exclude all output until a line matches the pattern and then include all output beginning with that line.

In ExtremeXOS software, the resulting command is as follows:

show specific show command syntax | {include | exclude | begin } regexp

The following describes the command syntax:

show specific show command syntax State the command. For example: show ports. (This is followed by the vertical bar (|) when used as the pipe character.)
include Display the lines that match the regular expression.
exclude Do not display the lines that match the regular expression.
begin Display all the lines starting with the first line that matches the regular expression.
regexp The regular expression to match. Regular expressions are case-sensitive. Special characters in regular expressions such as [ ], ?, and * have special significance to the Linux shell and it is therefore common to specify your regular expression in quotes to protect it from the shell.

Flow control

To display the status of “flow control” on the ports of a BlackDiamond 8810 switch, use the following command:

show ports 2:1-2 information detail | include "(Port | Flow Control)"

The output would resemble the following:

Port: 2:1
			Flow Control:   Rx-Pause: Enabled       Tx-Pause: Disabled
Priority Flow Control: Disabled

Port: 2:2
			Flow Control:   Rx-Pause: Enabled       Tx-Pause: Disabled
Priority Flow Control: Disabled

If the specified show command outputs a refreshed display, using the output display filter terminates the display without refreshing and a message is displayed to that effect.

This command is supported on most of the ExtremeXOS show commands. A few commands, for example, show tech-support, are not implemented in such a way as to make piping (filtering) possible.

The following table shows a summary of special characters.

Table 1. Definition of Regular Expression Characters
Operator Type Examples Description
Literal characters match a character exactly a A y 6 % @ Letters, digits and many special characters match exactly
\$ \^ \+ \\ \? Precede other special characters with a \ to cancel their regex special meaning
\n \t \r Literal new line, tab, return
Anchors and assertions ^ Starts with
$ Ends with
Character groups any one character from the group [aAeEiou] Any character listed from [ to ]
[^aAeEiou] Any character except aAeEio or u
[a-fA-F0-9] Any hex character (0 to 9 or a to f)
. Any character at all
Counts apply to previous element + One or more ("some")
* Zero or more ("perhaps some")
? Zero or one ("perhaps a")
Alternation | Either, or