In Cisco IOS software release 12.0 and later, a nice trick is to use the + , - and / characters with sh run and sh start commands to search for specific strings (or exclude strings) in a configuration. This is similar to “ include | exclude” pipe-sentence, but is available in startup or running configuration.
For example:
To use include to search for “voice” in the running configuration, type:
Router# sh run | include voice
Voice-card 2
Voice class permanent 1
No voice hpi capture buffer
Voice-port 2/0/0
Dial-peer voice 123456 voip
Router#
As with include, to exclude strings from output, pipe sh run with exclude and the string you want to filter
For example:
Router# sh run | exclude voice
------display configuration except any sentence with word / string voice.
With the sh run or sh start commands, if your terminal is set to display one page at a time, when the display stops scrolling at the bottom of the screen use the “+” , “-“ or “/” characters to search configuration lines.
For example, type +voice to get the same output as sh run | include voice
Type a hypen (-) to skip (exclude) lines that contain the string you want to filter out. You can add several strings to include or exclude, grouping them with the pipe (|) character. Do not allow spaces between the pipes.
For example, type “–voice|description|line” which excludes sentence with word / string voice or description or line.
The forward slash (/) character lets you find the first occurrence of the given string. It stops at the first occurrence of the string to search for the next line that contains the string, so to continue searching type “/” and the string you want to find again.
Very nice to see sharing of the knowledge
ReplyDeleteThank you Sir.
-- Subrata