cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
495
Views
0
Helpful
3
Replies

Using the | in show commands

cciementor
Level 1
Level 1

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 3

deilert
Level 6
Level 6

sh proc cpu | e 0.00

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

warren
Level 1
Level 1

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

Thanx!!