cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
64178
Views
37
Helpful
8
Replies

Grep in IOS Output

fb_webuser
Level 6
Level 6

I would like to campaign for "grep" support in the Cisco IOS! It would be really awesome to type a command like sh run to get the configs for all dial-peers with a specific session target ip.

---

Posted by WebUser Billy Bryant from Cisco Support Community App

8 Replies 8

Aaron Harrison
VIP Alumni
VIP Alumni

You mean like this?

show run | i dial-peer|session-target

?

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

danplacek
Level 4
Level 4

include (or 'i') will include all lines that match the criteria.

section (or 's') will include entire sections that match.

Ex:

sh run | s dial-peer

sh run | i load

It is not quite as powerful as grep... but still very useful.

In addition to include and section - begin and exclude can also be used to pipe the output in IOS:

sh run | begin dial-peer                  <<< it will show output begin from the config from dial-peers

sh ip int brief | exclude unassigned   << when you try to do sh ip int brief and intrested in ip info only

Also if you need to get multiple sections:

show run | section dial-peer |dspf     - should show only dial-peer and dsp farm configs.

For include with multiple lines Aaron had already posted above.

I think these all should give you a lot of flexibility - when you want to view only a section from show run.

For me this was my mistake. I haven't route to do anything.

Leo Laohoo
Hall of Fame
Hall of Fame

Cisco IOS supports regular expressions.  So you don't necessariyly have to use grep/egrep.

mrana0101
Level 1
Level 1

Hello fb_webuser

 

GREP is possible to run with show commands by enabling Cisco IOS Shell

try following: 

conf t 

shell processing full

exit

terminal shell (in exec mode)

 

now it is possible to run show commands with grep.

 

for example:

 

R1-2901#sh ver | grep 'cisco'

Technical Support: http://www.cisco.com/techsupport http://www.cisco.com/wwl/export/crypto/tool/stqrg.html export@cisco.com.

 

hope this helps :)

 

Ahsan Rana

Ahsan Rana

Thanks!!!

:-)

Ahsan Rana