Filter IOS command output with include and exclude

"Show" and "more" commands can spit out a ton of data to digest. To pinpoint the important information, use the "include" and "exclude" clauses. The syntax is fairly simple; just end the command with " | include" or " | exclude" at the end of the command, followed by a regular expression. Note the mandatory pipe (vertical bar) character (|).

"Include" causes the command to display only those results that match the regular expression, while "exclude" displays only those results that don't match the regular expression.

For example, the following command outputs the configuration, minus potentially sensitive lines that include "enable" or "username":

show running-config | exclude enable|username

No comments: