CCIE Security – filter output of show commands

by Jimmy Larsson on January 11, 2010

Did you know that you can use multiple arguments when piping IOS output thru include?

Works great on switches:

sw1#sh int | incl FastEthernet|input errors
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/1 is up, line protocol is up (connected)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/2 is up, line protocol is up (connected)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/3 is up, line protocol is up (connected)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/4 is administratively down, line protocol is down (disabled)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/5 is administratively down, line protocol is down (disabled)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
FastEthernet0/6 is administratively down, line protocol is down (disabled)
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
...
...
...

Works on routers:

r2#sh run | incl service|ntp
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
ntp server 192.168.1.6
r2#

And also works good on ASA:


fw1# sh run | incl interface|nameif|security-level
interface Vlan1
no nameif
no security-level
interface Vlan11
nameif inside
security-level 100
interface Vlan168
nameif outside
security-level 0

Of course, all of the above can also be done with grep . Like:


fw1# sh run | grep (Ethernet0/0|Ethernet0/1|Ethernet0/2)
interface Ethernet0/0
interface Ethernet0/1
interface Ethernet0/2
fw1#

Comments on this entry are closed.

Previous post:

Next post: