10-21-2002 05:57 AM - edited 03-02-2019 02:14 AM
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....
10-21-2002 06:05 AM
sh proc cpu | e 0.00
Using the pipe is dependent on the IOS Rev you are using .
10-21-2002 07:02 AM
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
10-21-2002 09:39 AM
Thanx!!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide