cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
369
Views
4
Helpful
2
Replies

IOS conditional searches

ctongow
Level 1
Level 1

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 2

mark.edwards
Level 1
Level 1

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

Jon Marshall
Hall of Fame
Hall of Fame

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card