cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Cisco Community Designated VIP Class of 2020

1456
Views
0
Helpful
10
Replies
Beginner

CLI Output filter - show int counters errors

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

 

 

Everyone's tags (1)
10 REPLIES 10
Highlighted
Beginner

Please try with:sh int

Please try with:

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

 

In Nexus switch and let me know.

Beginner

Hello Omar, It works great on

Hello Omar,

 

It works great on my nexus. Thank you.

But not on my catalyst 6k. Argh

 

Regards,

 

Enthusiast

Try this.sh int counter | ex

Try this.

sh int counter | ex 0          0          0          0         0           0

:)

 

CF

Enthusiast

This should also work. sh int

This should also work.

 

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

 

CF

Beginner

This one almost works :-) 

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

 

Ju

Enthusiast

I assume the interface

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

 

 

Beginner

These kind of lines are

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

 

 

Beginner

thank you but it doesn't work

thank you but it doesn't work.

Ju

Beginner

sh int counter | ex          

sh int counter | ex                      0             0             0             0

Beginner

This should do it:

This should do it:

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

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

CreatePlease to create content
Content for Community-Ad