Filtering Output
Use
In the Cisco IOS, there are several different ways to control the output so that you get only the information that you want.
Syntax
<any command> | <include or exclude or section> <text string or regular expression>< | ><text string or regular expression>
Options
<include> | Only show lines that contain a given text string |
<begin> | Shows all output after a given text string is found |
<exclude> | Show all output except lines containing the given text string |
<section> | Show just a section of output. |
< | > | And/OR statement |
< / > | Like the begin string, but used when you see the ‘–more–‘ indicating multiple pages of output. |
Example
In this example we will use the show ip interface brief command but exclude any unassiged interfaces . First, here is the regular output
R4(config-if)#do show ip interface brief |
Here is the filtered output
R4(config-if)#do show ip interface brief | exclude unassigned |
In this example we will just view the OSPF configuration from the show run output
R4(config-if)#do show run | section ospf |
In this example we will just view the interface name and its cost from the show ip ospf interface command.
R1(config)#do show ip ospf interface | include is up|Cost |
In this example we will just view the show run information starting with the router ospf configuration
R1(config)#do show run | begin router ospf R1(config) |
In this example we will use the / command with show run to start with ip address.
2611XM#show run Current configuration : 1437 bytes
|