cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2831
Views
0
Helpful
3
Replies

Re-format cisco cli output to diplay lines correctly.

jontittle
Level 1
Level 1

 

Does anyone know of a tool that will reformat a cut+paste of a bgp forwarding table correctly. Maybe an excel sheet with formula embedded or something similar that will create a single line per subnet route.

I'm trying to compare 3 VRF routing tables to find duplicates. The largest is 80,000 lines.

Due to the CLI column widths on the output of 'sh ip bgp' the longer subnets cause a line break in the output. This means when I come to cut and paste into excel and then try and use the 'Text to columns' tool it does not work correctly. If I copy to Word or notepad first I have hundreds of lines to manually edit.

Surely other people out there have hit this frustrating problem ? Previously I've just bitten the bullet and fixed the formatting manually but these large routing tables will take too long to fix and possible introduce errors in the process.

 

Any advice ?

 

Thanks

3 Replies 3

Joseph W. Doherty
Hall of Fame
Hall of Fame

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

What you might be able to do is inform your telnet emulator to use a wider line, wide enough to take your bgp table without wrapping lines.

I run my emulator at 120 characters, which precludes much line wrapping vs. the common 80.

FlorianCokl
Level 1
Level 1

What you mean is this, right?

Instead of looking like:

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - best2

   Network            Next Hop            Metric     LocPrf     Weight Path
Route Distinguisher: 10.254.254.1:32777    (L2VNI 55555)
*>l[2]:[0]:[0]:[48]:[0050.7966.6804]:[0]:[0.0.0.0]/216
                      10.253.253.1                      100      32768 i
*>i[2]:[0]:[0]:[48]:[0050.7966.6805]:[0]:[0.0.0.0]/216
                      10.253.253.2                      100          0 i

it would be nice to have it like this:

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - best2

   Network            Next Hop        Metric     LocPrf   Weight Path
Route Distinguisher: 10.254.254.1:32777    (L2VNI 55555)
*>l[2]:[0]:[0]:[48]:[0050.7966.6804]:[0]:[0.0.0.0]/216 10.253.253.1                  100      32768 i
*>i[2]:[0]:[0]:[48]:[0050.7966.6805]:[0]:[0.0.0.0]/216 10.253.253.2                  100          0 i

I would love to see that, too.

 

Hello Folks,

A few options and some ideas I have used in the past to address this issue:

Option 1. You can try the programmatic method, export to a file and proceed to use a script(to be written) to format the data. 

Option 2. Export the output of the data using xml, then use Excel to import the data into a worksheet. This has worked well for me in NXOS. Not sure if IOS supports this option. 

blueiguana_0-1684757688478.png

The command output for <sh vlan> import in Excel looks like this:

blueiguana_1-1684757730918.png

Thank you.