2

I was looking at a previous question about this where a command was given to look for all ports that had not been used in 6 weeks. I ran the command but it doesn't give the port names just the line in the output that has the last input. I'm not a regular expression person so is there someone who can change this to show the port names as well.

Command:

show int | i proto.*notconnect|proto.*administratively down|Last in.* [6-9]w|Last in.* [0-9][0-9]w|[0-9]y|disabled|Last input never, output never, output hang never

Output:
  Last input never, output 7w5d, output hang never
  Last input never, output 7w5d, output hang never
  Last input never, output 17w1d, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output 21w6d, output hang never
  Last input never, output 21w3d, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output 7w1d, output hang never
  Last input never, output 7w5d, output hang never
  Last input never, output 8w4d, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
  Last input never, output never, output hang never
3
  • OK, I just used this on a C3750 and it did give the port names. So the switches I'm looking at are pretty old (C3548). Can the command be edited for them?
    – Quinton
    Oct 4, 2016 at 16:23
  • 1
    Could you please edit your question and add show interface (or part of it, e.g. just one interface) and perhaps also from the c3750 (as I don't see how it could work there)
    – hertitu
    Oct 4, 2016 at 20:55
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 15, 2017 at 4:05

2 Answers 2

1

You are only going to get the specific line of the output for a filter, and that line doesn't include the interface. You would just need to run the command without the filters to include the interface, and that will include all the lines for all the interfaces, which is what you seem to want to eliminate.

You may be able to use the show interfaces counters command. This command will show the statistics per interface since the last time the counters were cleared:

Switch1#show interfaces counters

Port                InOctets   InUcastPkts   InMcastPkts   InBcastPkts
Gi1/0/1           2067013697      20374822        209358          9989
Gi1/0/2                    0             0             0             0
Gi1/0/3                    0             0             0             0
Gi1/0/4           1655040672       5855659           611         77829
Gi1/0/5                    0             0             0             0
Gi1/0/6             17864697         51741         15659            48
Gi1/0/7            605795797       2338136             0          1464
Gi1/0/8             62153075        312522         80188            22
-1

If you add "|interface" to that very long string it should also grab the interface names.

1
  • Sorry should be "|GigabitEthernet"
    – John K.
    Oct 26, 2016 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.