Hidden Command / Syntax

Unanswered Question
Apr 21st, 2008
User Badges:

Looking for the command to filter multiple lines from a configuration. I found it online a couple of months ago but didn't write it down and now can't find it.


I am trying to 'sh run | i ...' where it will show me each interface in the running config as well as the description but no other interface information, such as...


interface Serial1/0/1:0

desc Company A

!

interface Serial1/0/2:0

desc Company B



and so on. Can someone recall the correct syntax? Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (1 ratings)
Loading.
Yudong Wu Mon, 04/21/2008 - 09:31
User Badges:
  • Gold, 750 points or more

try "show run | i interface|desc"

sross35 Mon, 04/21/2008 - 09:34
User Badges:

Pretty close and that will work, but it there a way to limit it further by interface type such as serial interfaces only and their descriptions?


I got a little closer with

sh int | i Serial|Desc


but that shows desc from other interfaces without the interface heading.

Yudong Wu Mon, 04/21/2008 - 09:39
User Badges:
  • Gold, 750 points or more

try "show run | i interface Serial|desc"

sross35 Mon, 04/21/2008 - 09:42
User Badges:

That's pretty close too, but shows desc from other lines such as bgp neighbor desc and prefix-list desc.


Maybe it's not possible, but I will keep checking.

Yudong Wu Mon, 04/21/2008 - 09:46
User Badges:
  • Gold, 750 points or more

try this

show run | i interface Serial|^ desc


Note: there is a space between "^" and "desc"

sross35 Mon, 04/21/2008 - 09:51
User Badges:

Still get only the "interface Serial" lines but also get desc from other interfaces also.


Such as


interface Serial1/0/1:0

desc Company A

interface Serial1/0/2:0

desc Company B

interface Serial1/0/3:0

description Company C

description Ethernet Company D

description GigbitEthernet Company E

Yudong Wu Mon, 04/21/2008 - 09:59
User Badges:
  • Gold, 750 points or more

the pipe operator "|" is line by line based. So it can not tell whether "description" is for serial or not since this need interpret result of the previous line.


So, it think it might not work by only using "|".


Sorry, i am not aware of the other solution for you.

sross35 Mon, 04/21/2008 - 10:04
User Badges:

Closer than I was, thanks for the help.

Actions

This Discussion