New Horizons Get Schooled Blog

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

_____________________________________________

New Horizons is an Authorized Cisco Training Partner. View our Cisco classes here!

Posted on 9/5/12 8:35 AM by Get Schooled in Cisco, in commands, in exclude, in include, in Tips & Tricks

Get Schooled

Written by Get Schooled

Search by Topic

    Lists by Topic

    see all

    Be at the center of it all.

    SUBSCRIBE TO NEWSLETTER

    Knowledge Ninjas

    a web-based service that allows software application end users to access a subject matter expert in real-time via a chat interface to resolve questions or problems they encounter in their specific software.