beautypg.com

Searching and filtering output from show commands – Brocade TurboIron 24X Series Configuration Guide User Manual

Page 50

background image

16

Brocade TurboIron 24X Series Configuration Guide

53-1003053-01

Using and port number with CLI commands

Searching and filtering output from Show commands

You can filter output from show commands to display lines containing a specified string, lines that
do not contain a specified string, or output starting with a line containing a specified string. The
search string is a regular expression consisting of a single character or string of characters. You
can use special characters to construct complex regular expressions. Refer to

“Using special

characters in regular expressions”

on page 18 for information on special characters used with

regular expressions.

Using include to display lines containing a specified string
The include modifier filters the output of the show interface command for port 11 so it displays only
lines containing the word “Internet”. This command can be used to display the IP address of the
interface.

TurboIron#show interface e 11 | include Internet

Internet address is 192.168.1.11/24, MTU 1518 bytes, encapsulation ethernet

Syntax: show-command | include

NOTE

The vertical bar ( | ) is part of the command.

The regular expression specified as the search string is case sensitive. In the example above, a
search string of “Internet” would match the line containing the IP address, but a search string of
“internet” would not.

Using exclude to display lines that do not contain a specified string
The exclude modifier filters the output of the show who command so it displays only lines that do
not contain the word “closed”. This command can be used to display open connections to the
device

TurboIron#show who | exclude closed

Console connections:

established

you are connecting to this session

2 seconds in idle

Telnet connections (inbound):

1 established, client ip address 192.168.9.37

27 seconds in idle

Telnet connection (outbound):

SSH connections:

Syntax: show-command | exclude <regular-expression>

Using begin to display lines starting with a specified string
The begin modifier filters the output of the show who command so it displays output starting with
the first line that contains the word “SSH”. This command can be used to display information
about SSH connections to the device.

TurboIron#show who | begin SSH

SSH connections:

1 established, client ip address 192.168.9.210

7 seconds in idle

2 closed