cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3391
Views
0
Helpful
10
Replies

CLI Output filter - show int counters errors

ju.mahieu
Level 1
Level 1

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

 

 

10 Replies 10

OMAR CANDARAVE
Level 1
Level 1

Please try with:

sh int counters errors | ex "0 \+0 \+0 \+0 \+0 \+0"

 

In Nexus switch and let me know.

Hello Omar,

 

It works great on my nexus. Thank you.

But not on my catalyst 6k. Argh

 

Regards,

 

Try this.

sh int counter | ex 0          0          0          0         0           0

:)

 

CF

This should also work.

 

sh int counters | ex 0(.*)0(.*)0(.*)0(.*)0(.*)0

 

CF

This one almost works :-)  but it filters also the lines with Gi0/2 ....

 

Ju

I assume any interface that is being left out,  interface counter value is ending at 0 for that interface. eg:12340

 

 

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

 

 

thank you but it doesn't work.

Ju

sh int counter | ex                      0             0             0             0

uday singh
Level 1
Level 1

This should do it:

sh int counter erro | in ^(.+ )[123456789]|Port

NOTE:  there is a white space after the '+' sign.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: