An Introduction to Output Modifiers

Ask any experienced Cisco Engineer and they will tell you one of the basic commands they can’t live without is the output modifiers. While they aren’t required to get the job done they do make things easier at times. As you would expect output modifiers modify the output. If you are a linux/unix/bsd person you are most likely familiar with grep. This of the output modifiers as the grep for Cisco.

This is the first of a series of posts about output modifiers. To start with I am going to cover four basic output modifiers; include, exclude, begin and section. In future posts I will cover the other modifiers and some advanced patterning. As with most Cisco features and commands not all modifiers will be available on all platforms and versions.

include

This modifier only returns lines that match the pattern given. This is useful for requiring quick pieces of information from the configuration and other output heavy commands. Some of the modifier variations I use often are:

show version | include ID
show frame pvc | include rate
show running-config | include alias

I would recommend you play around with this modifier as I am sure you can come up with some great variations of this.

exclude

As you have probably gathered this is the absolute opposite of the include modifier. I don’t use this modifier nearly as much as include but one of the great uses is to look at your processes and how much cpu they are consuming. If you have ever looked you will find a very large number of processes of which most are using no resources. Using the following command will only show you processes that actually use resources.

show processes cpu | exclude 0.00%__0.00%__0.00%

If you compare the two outputs you will notice the exclude modifier greatly reduces the output. I would recommend making an alias in your device for this command as it is quite long to type and if your device is truly suffering a cpu resource issue the last thing you want to do is type a long command.

begin

If you want to jump to a section of configuration without having to smash the space bar a bunch of times you can just use the begin modifier. If you are looking at a high density switch such as a 3750, 4500 or 6500 this can be useful to jump to the various switches/blades. For example:

show running-config | begin FastEthernet2/0/

There isn’t much more to be said about this modifier. It is fairly straight forward.

section

This is very handy for getting sections of configuration. How many times do you want to look at a section of code such as an interface, controller, route-map or dial-peer without seeing the rest of the configuration. This modifier makes this very simple. For example:

show running-config | section controller
show running-config | section Serial
show running-config | section line

You will notice that this modifier is actually a superset of include as it will return any lines that matches the pattern but if that line is a section title it also includes the other lines in the section.


3 Responses to “An Introduction to Output Modifiers”


  1. Davis,

    Cool article. I’ve been a network engineer for several years and had never seen the “section” output modifier, but have wished for something like it many times.


  2. Mihails Nikitins,

    Hi,

    Thank you for the page! Do you know how to compose case insensitive include/exclude expressions?

    BR,
    Mihails


  3. dedwards,

    As far as I know there is no way to allow for case-insensitive regular expressions in IOS.


Leave a Reply