cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2859
Views
5
Helpful
1
Replies

Grep particular section in ASR

networkinggeek
Level 1
Level 1

How would you pull the info from the configs

#show running-config router ospf | utility egrep 0/3/0/0
interface TenGigE0/3/0/0

 

#show running-config router ospf | in 0/3/0/0
interface TenGigE0/3/0/0

 

This command only brings me the interface (which I do not need), but what I want need is the whole section and sub-section of ospf configuration related to that interface, like what process number and area this interface is in? 

How can I pull that up? Any linux gurus to help out? :)

 

Thanks

Sal

 

1 Accepted Solution

Accepted Solutions

pigallo
Cisco Employee
Cisco Employee

hello,

 

you have two main options to achieve this.
First with egrep -A  you can append n lines to the egrep matched string output.
If you know that ASR configuration is hierarchical you can search for a match of a particular indented head block and look n lines after it.
For example the area field:
show run router ospf XY | utility egrep area -A 10
will return everything inside the area config block (interfaces included) of ospf process XY and this is good option because it will iterate to look inside each block matched by egrep utility for 10 lines more. So if you have, let`s say, more than one area in your process this command will work just fine.


Or you could use the "show run formal" construct to search for the specific interface configuration.

This will highlight only the specific portion of configuration interested by the included match.

View solution in original post

1 Reply 1

pigallo
Cisco Employee
Cisco Employee

hello,

 

you have two main options to achieve this.
First with egrep -A  you can append n lines to the egrep matched string output.
If you know that ASR configuration is hierarchical you can search for a match of a particular indented head block and look n lines after it.
For example the area field:
show run router ospf XY | utility egrep area -A 10
will return everything inside the area config block (interfaces included) of ospf process XY and this is good option because it will iterate to look inside each block matched by egrep utility for 10 lines more. So if you have, let`s say, more than one area in your process this command will work just fine.


Or you could use the "show run formal" construct to search for the specific interface configuration.

This will highlight only the specific portion of configuration interested by the included match.