×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

IOS conditional searches

Unanswered Question
Dec 8th, 2006
User Badges:

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 2 (2 ratings)
Loading.
Jon Marshall Fri, 12/08/2006 - 02:11
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

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


Actions

This Discussion