01-26-2013 06:33 AM - edited 03-04-2019 06:51 PM
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
01-26-2013 08:40 AM
Can you try
sh mac address-table | exclude Gi0/1|Fa0/5
01-26-2013 10:31 AM
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
01-26-2013 02:40 PM
Please rate helpul posts.
01-27-2013 02:44 AM
The simplified command-structrure is:
"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:
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide