show include regular expression

Unanswered Question
Jul 8th, 2010

I'm trying to parse the output of "show ip eigrp topology". We are using route tags, and I want to see all the routes with a particular tag, but I also need to see the gateway address which appears on the following line, directly under the line with the tag.  (Here is a sample output).

P 192.249.51.10/31, 2 successors, FD is 3328, tag is 11
         via 3.51.8.69 (3328/3072), GigabitEthernet0/3
P 3.159.156.0/22, 1 successors, FD is 25623552, tag is 220
        via Redistributed (25623552/0)
P 3.69.199.128/27, 1 successors, FD is 60109312, tag is 210
        via Redistributed (60109312/0)

P 192.249.51.10/31, 1 successors, FD is 3328, tag is 11
        via Redistributed (3328/0)
P 3.27.25.0/24, 1 successors, FD is 25623296, tag is 202
        via Redistributed (25623296/0)
P 3.159.156.0/22, 1 successors, FD is 25623552, tag is 220
        via Redistributed (25623552/0)

I need a way to show just the following:

P 192.249.51.10/31, 2 successors, FD is 3328, tag is 11
         via 3.51.8.69 (3328/3072), GigabitEthernet0/3
P 192.249.51.10/31, 1 successors, FD is 3328, tag is 11
        via Redistributed (3328/0)

I could probably do it with a TCL script, but I'd like to find a simpler method.  Something like "show ip eigrp topo | in tag is 11$/n.via"

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
derek.small Thu, 07/08/2010 - 14:33

Well, if anyone else is interested.  I wasn't able to come up with anything simple, but I wrote a TCL script that works.

log_user 0; set results [exec "show ip eigrp topo"]; set output [string map {"\r\n        via" ", \t\tvia"} $results]; foreach int [regexp -all -line -inline "^.*tag is 101,.*$" $output] {puts $int}

Just plug in your own tag for 101 or your own search string for "^.*tag is 101,.*$"

Actions

This Discussion