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

IOS conditional searches

Does anyone know how to search command output based on more than one condition? eg. sh ip route | inc 10.10. | exc ATM ? Of course the eg. doesn't work. Just need to know how to issue conditional searches. Can regexp be used?

2 REPLIES

Re: IOS conditional searches

A TCL script would be able to do this.Sorry but I don't think there is an easier way to do this under IOS.

http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801a75a7.html#wp1027265

Hall of Fame Super Blue

Re: IOS conditional searches

Obviously it depends on your IOS to some extent. The main problem seems to be that there is not negation character for a string in the Cisco regular expressions on the IOS (you can negate a single character but that is not much use here) so it is diffcult to say include and then exclude in a regular expression.

The best i seem to be able to do is something like the following:-

DC-BBP-F00-DS1#sh ip ro | include 10.231.198

C 10.231.198.0/25 is directly connected, Vlan61

C 10.231.198.224/28 is directly connected, Vlan70

C 10.231.198.240/28 is directly connected, Vlan71

To exclude Vlan61 from the output you would need to list all the other interfaces ie.

DC-BBP-F00-DS1#sh ip ro | include

10.231.198.*(Vlan70|Vlan71).*

C 10.231.198.224/28 is directly connected, Vlan70

C 10.231.198.240/28 is directly connected, Vlan71

Maybe someone can do better :-)

HTH

142
Views
4
Helpful
2
Replies
CreatePlease to create content