A simple output filter for “show cdp neighbors” using a compound regular expression (Cisco IOS)

Here is a simple filter I’ve used on ’show cdp’ output, which lets me get information quickly.

MalbecMDF#show cdp neighbor detail | include (---|Device ID|IP address|Platform)

In practice, I generally cut the command down to:
sh cdp ne d | inc (blah|blah)
It is probably best to start with obvious match choices, before pairing them down, as you can find yourself surprised with the text that is grabbed from different types of devices if you’re basing your regular expression match on a small sample.

In any case, the output should come out something like this:

MalbecMDF#sh cdp ne d | inc (---|e ID|IP add|Plat)
-------------------------
Device ID: SummaC-6509
IP address: 10.77.234.131
Platform: cisco WS-C6509-E, Capabilities: Router Switch IGMP
-------------------------
Device ID: Malbec-AP10
IP address: 10.88.129.22
Platform: cisco AIR-AP1231G-A-K9 , Capabilities: Trans-Bridge
-------------------------
Device ID: Malbec-AP11
IP address: 10.88.129.29
Platform: cisco AIR-AP1231G-A-K9 , Capabilities: Trans-Bridge
-------------------------

Tags: ,

Leave a Reply

You must be logged in to post a comment.