cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3880
Views
0
Helpful
4
Replies

sh mac address-table | exclude Gi0/1

acbennyma
Level 1
Level 1

Any command that I can exclude Gi0/1 and Fa0/5 so that the output result will not contain Gi0/1 and Fa0/5

switch#sh mac address-table | exclude Gi0/1
Mac Address Table
-------------------------------------------

Vlan Mac Address Type Ports
---- ----------- -------- -----
All 0100.0ccc.cccc STATIC CPU
All 0100.0ccc.cccd STATIC CPU
All 0180.c200.0000 STATIC CPU
All 0180.c200.0001 STATIC CPU
All 0180.c200.0002 STATIC CPU
All 0180.c200.0003 STATIC CPU
All 0180.c200.0009 STATIC CPU
328 0001.e6a1.01e9 DYNAMIC Fa0/5
328 0017.a498.9fe6 DYNAMIC Fa0/20
328 0023.7d50.9d85 DYNAMIC Fa0/1
328 0023.7dba.370a DYNAMIC Fa0/9

4 Replies 4

Edison Ortiz
Hall of Fame
Hall of Fame

Can you try

sh mac address-table | exclude Gi0/1|Fa0/5

Got it. is it exclude is equal to "and" whereas include is equal to "or"

sh mac address-table | exclude Gi0/1|Fa0/5 

sh mac address-table | include Gi0/1|Fa0/5

Please rate helpul posts.

The simplified command-structrure is:

| {begin | include | exclude}

"include" shows only lines that contain the regular expression.

"exclude" shows only lines that not contain the regular expression.

The "or" comes into play with the regular expression. That's a pattern which descibres what you want to filter.

In this case it's a simple one, it means "Gi0/1" OR "Fa0/5" (OR = "|")

General information about limiting the output of show-commands you can find here:

http://www.cisco.com/en/US/docs/ios-xml/ios/fundamentals/command/show_through_show_fm_summary.html

Information and examples about Cisco's regular expressions:

http://www.cisco.com/en/US/docs/ios/12_2/termserv/configuration/guide/tcfaapre_ps1835_TSD_Products_Configuration_Guide_Chapter.html

At first it might seem complicated but iIt's worth obtaining some basic knowledge of regular expressions - that's what the CLI makes much more powerful than any GUI.

HTH

Rolf

Review Cisco Networking for a $25 gift card