04-21-2008 09:18 AM - edited 03-05-2019 10:31 PM
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
04-21-2008 09:31 AM
try "show run | i interface|desc"
04-21-2008 09:34 AM
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.
04-21-2008 09:39 AM
try "show run | i interface Serial|desc"
04-21-2008 09:42 AM
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.
04-21-2008 09:46 AM
try this
show run | i interface Serial|^ desc
Note: there is a space between "^" and "desc"
04-21-2008 09:51 AM
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
04-21-2008 09:59 AM
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.
04-21-2008 10:04 AM
Closer than I was, thanks for the help.
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: