12-08-2006 01:14 AM - edited 03-05-2019 01:14 PM
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?
12-08-2006 01:48 AM
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.
12-08-2006 02:11 AM
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
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: