cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1164
Views
0
Helpful
1
Replies

show include regular expression

derek.small
Level 5
Level 5

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"

1 Reply 1

derek.small
Level 5
Level 5

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,.*$"

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: