Searching for text using pattern matching with show command
Selected portions of the output are displayed, depending on the parameters chosen.
Syntax:
show {< command option > | < include | exclude | begin >} <regular expression>
Uses matching pattern searches to display selected portions of the output from a
show
command. There is no limit to the number of characters that can be matched. Only regular expressions are permitted; symbols such as the asterisk cannot be substituted to perform more general matching.
|
Only the lines that contain the matching pattern are displayed in the output. |
|
Only the lines that contain the matching pattern are not displayed in the output. |
|
The display of the output begins with the line that contains the matching pattern. |
Pattern matching is case-sensitive.
Following are examples of what portions of the running config file display depending on the option chosen.
Pattern matching with include option
switch(config)# show run | include ipv6 1 ipv6 enable ipv6 enable ipv6 access-list "EH-01" switch(config)#
1Displays only lines that contain “ipv6”.
Pattern matching with exclude option
switch(config)# show run | exclude ipv6 1 Running configuration: ; J9299A Configuration Editor; Created on release #WB.15.XX hostname "Switch" snmp-server community "notpublic" Unrestricted vlan 1 name "DEFAULT_VLAN" untagged A1-A24,B1-B20 ip address dhcp-bootp no untagged B21-B24 exit vlan 20 name "VLAN20" untagged B21-B24 no ip address exit policy qos "michael" exit sequence 10 deny tcp 2001:db8:255::/48 2001:db8:125::/48 exit no autorun password manager
1Displays all lines that do not contain “ipv6”.
Pattern matching with begin option
switch(config)# show run | begin ipv6 1 ipv6 enable no untagged 21-24 exit vlan 20 name "VLAN20" untagged 21-24 ipv6 enable no ip address exit policy qos "michael" exit ipv6 access-list "EH-01" sequence 10 deny tcp 2001:db8:255::/48 2001:db8:125::/48 exit no autorun password manager
1Displays the running config beginning at the first line that contains “ipv6”.
The following is an Example: of the
show arp
command output, and then the output displayed when the
include
option has the IP address of
15.255.128.1
as the regular expression.
The show arp command and pattern matching with the include option
switch(config)# show arp IP ARP table IP Address MAC Address Type Port ------------- -------------- ------- ---- 15.255.128.1 00000c-07ac00 dynamic B1 15.255.131.19 00a0c9-b1503d dynamic 15.255.133.150 000bcd-3cbeec dynamic B1 switch(config)# show arp | include 15.255.128.1 15.255.128.1 00000c-07ac00 dynamic B1