Cisco Filtering Output

As network administrators, we often need to filter and refine the output of our Cisco router commands. This can be crucial for troubleshooting, configuration management, or simply for reducing unnecessary information. In this article, we will explore how to use various Cisco commands to filter the output.

Introduction

When working with Cisco routers, it’s essential to understand how to manipulate the output of your commands. By using filters like “include,” “exclude,” and “section,” you can tailor the results to suit your specific needs. In this post, we will delve into these filtering techniques and provide examples of when to use each.

Step 1: Using “Include”

The “include” command allows you to display only the lines in the output that contain a specified keyword or phrase. This is useful for retrieving information about specific interfaces, protocols, or configurations.

Example:

Router# show running-config | include interface
interface Ethernet0/0
interface Ethernet1/0
interface Serial2/0
interface Serial3/0

In this example, we’re using the “include” command to display only the lines that contain the keyword “interface.” This will show us a list of all interfaces on the router.

Step 2: Using “Exclude”

The “exclude” command is used in conjunction with the “include” command to exclude specific keywords or phrases from the output. This can be useful for filtering out unnecessary information.

Example:

Router# show running-config | exclude interface
no cdp enable

In this example, we’re using the “exclude” command to remove lines that contain the keyword “interface.” As a result, we’re left with only the lines that mention “no cdp enable.”

Step 3: Using “Section”

The “section” command allows you to include or exclude specific sections of the output. This can be particularly useful for filtering configuration commands.

Example:

Router# show running-config | section include interface
interface Ethernet0/0
shutdown
no cdp enable

In this example, we’re using the “section” command to display only the lines that contain the keyword “interface.” Within those lines, we’re then including or excluding specific sections (in this case, “shutdown” and “no cdp enable”).

Conclusion

By mastering Cisco’s filtering commands (“include,” “exclude,” and “section”), you can refine your output and make your troubleshooting and configuration processes more efficient. Remember to use these techniques in conjunction with each other for maximum effectiveness.