Summarize IOS printouts (example: Frame Relay DLCIs)

I've always wanted a short summary display of DLCIs configured on my Frame Relay boxes (or whatever your favorite WAN technology is), but the only printout I would get from the router would be the lengthy show frame pvc printout. Fortunately, a judicious use of output filters can get you a summary printout from almost anything Cisco IOS produces. For example, I would like to see just the highlighted lines in my show frame pvc printout:
b2#show frame pvc

PVC Statistics for interface Serial0/0/0 (Frame Relay DTE)

Active Inactive Deleted Static
Local 1 0 0 0
Switched 0 0 0 0
Unused 3 0 0 0

DLCI = 101, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0.101

input pkts 1003 output pkts 948 in bytes 107601
out bytes 106438 dropped pkts 68 in pkts dropped 68
out pkts dropped 0 out bytes dropped 0
... rest deleted ...
The first line I'm interested in contains the pattern for interface, the second one DLCI USAGE. My output filter would thus have to match any one of these patterns:
b2#show frame pvc ¦ include (for interface¦DLCI USAGE)
PVC Statistics for interface Serial0/0/0 (Frame Relay DTE)
DLCI = 101, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0.101
DLCI = 201, DLCI USAGE = UNUSED, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0
DLCI = 302, DLCI USAGE = UNUSED, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0
DLCI = 401, DLCI USAGE = UNUSED, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0
And to add icing on the cake, I defined an alias with the alias exec dlci show frame pvc ¦ include (for interface ¦ DLCI USAGE) configuration command. Now I can display the FR DLCI status with a simple dlci command.

4 comments:

  1. Looks like the pipe character ¦ isn't showing in your output there. ¦ will show that in HTML reliably.

    I love this trick, though. I wish there was a detailed study on exactly which bits of Regular Expression functionality are implemented in the include/exclude/begin output filters. I actually liked "begin" so much that I duplicated its functionality on my FreeBSD machine.

    Just found your blog yesterday, looks to be a great resource.
  2. The documentation on Cisco IOS regular expressions can be found in the most unlikely place: the Appendix A of the Cisco IOS Terminal Services Configuration Guide.
  3. Thank you for that! That is, indeed, an amazingly unlikely place for such a wonderful guide. I have added it to my bookmarks.
  4. Cool tip bud, I posted about include it at my blog months ago, but I didnt had the trick :)

    Cool blog too, congrats !
Add comment
Sidebar