Searching for text using pattern matching with show command

Selected portions of the output are displayed, depending on the parameters chosen.


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"
  • 1Displays only lines that contain “ipv6”.

Pattern matching with begin option

switch(config)# show run | begin ipv6 1
   ipv6 enable
   no untagged 21-24
vlan 20
   name "VLAN20"
   untagged 21-24
   ipv6 enable
   no ip address
policy qos "michael"
ipv6 access-list "EH-01"
   sequence 10 deny tcp 2001:db8:255::/48 2001:db8:125::/48
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 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
  -------------   -------------- ------- ----    00000c-07ac00  dynamic B1   00a0c9-b1503d  dynamic  000bcd-3cbeec  dynamic B1

switch(config)# show arp | include    00000c-07ac00  dynamic B1