02-25-2015 08:55 AM - edited 03-07-2019 10:50 PM
Hi,
On catalyst and Nexus, I would like to filter the lines with 0 0 0 0 0 from the "show int counters errors" result.
Result without filter :
Switch#sh int counters errors
Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize OutDiscards
Gi1/1 0 0 0 0 0 0
Gi1/2 0 0 0 0 0 0
Gi1/3 0 0 0 0 0 0
Gi1/4 0 0 0 0 0 0
Gi1/5 0 0 0 0 0 0
Gi1/6 0 0 0 0 5500 0
Gi1/7 0 0 0 0 0 0
Gi1/8 0 0 0 0 0 6005
My expected result
Switch#sh int counters errors | exclude or grep ???
Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize OutDiscards
Gi1/6 0 0 0 0 5500 0
Gi1/8 0 0 0 0 0 6005
Thank you for your help.
Regards.
Ju
02-25-2015 05:15 PM
Please try with:
sh int counters errors | ex "0 \+0 \+0 \+0 \+0 \+0"
In Nexus switch and let me know.
02-26-2015 03:49 AM
Hello Omar,
It works great on my nexus. Thank you.
But not on my catalyst 6k. Argh
Regards,
02-26-2015 04:21 AM
Try this.
sh int counter | ex 0 0 0 0 0 0
:)
CF
02-26-2015 04:30 AM
This should also work.
sh int counters | ex 0(.*)0(.*)0(.*)0(.*)0(.*)0
CF
02-26-2015 05:32 AM
This one almost works :-) but it filters also the lines with Gi0/2 ....
Ju
02-26-2015 06:43 AM
I assume any interface that is being left out, interface counter value is ending at 0 for that interface. eg:12340
02-26-2015 07:15 AM
These kind of lines are filtered:
sh int counters errors | ex 0(.*)0(.*)0(.*)0(.*)0(.*)0
Gi1/0/12 0 0 0 0 0 83
Gi2/0/20 0 0 0 0 0 5343759
Gi2/0/21 0 0 0 0 0 5343135
Gi2/0/22 0 0 0 0 0 5344382
Po2 0 0 0 0 0 104
Thank you for your help.
Ju
02-26-2015 05:29 AM
thank you but it doesn't work.
Ju
12-30-2016 10:56 AM
sh int counter | ex 0 0 0 0
01-26-2017 02:55 PM
This should do it:
sh int counter erro | in ^(.+ )[123456789]|Port
NOTE: there is a white space after the '+' sign.
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