Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Using the | in show commands

Can any one refer me to examples of using the command Piping capabilities when doing SHOW commands I.E.

show ip route ospf | include ( I need better examples here)???

Thanx in advance

Todd....

3 REPLIES
Silver

Re: Using the | in show commands

sh proc cpu | e 0.00

Using the pipe is dependent on the IOS Rev you are using .

New Member

Re: Using the | in show commands

The | include is very similar to the "grep" command on UNIX machines.

For example, if you do "sho ip route" you will get a list of all routes that the router knows (LOTS if you are running BGP!). If you just want the router that you know from OSPF, you can do "sho ip route | inc O" which will show all lines from the output of "sho ip route" that include the letter "O".

The | include parsing understands (some) regular-expressions*, so it can be quite powerful (eg. you can get all routes known via static OR ospf with "sho ip route | inc O|S). You can also do things like "sho run | inc access-group" to see what ACL's are being used on interfaces. A related comamnd is "| begin", which shows all lines starting with whatever matches. For example, if you have a long configuration you can do "sho run | begin router ospf" which will display the running configuration, starting at the line that contains "router ospf". This saves alot of time....

* There is a reg-exp turotial here:http://www.robelle.com/smugbook/regexpr.html

New Member

Re: Using the | in show commands

Thanx!!

131
Views
0
Helpful
3
Replies
CreatePlease to create content