Lets say I have millions of packets to look through and I want to see how many times a packet was sent to a certain port number.
Here are some of the packets:
10:27:46.227407 IP 85.130.236.26.54156 > 139.91.133.120.60679: tcp 0
10:27:46.337038 IP 211.142.173.14.80 > 139.91.138.125.56163: tcp 0
10:27:46.511241 IP 211.49.224.217.3389 > 139.91.131.47.6973: tcp 0
I want to look through the 2nd port number here so:
60679, 53163, 6973, etc
So I can use:
grep -c '\.80:' output.txt
To count all the times port 80 was used. But is there a way for it to display all the ports that were used and how many times it was found in this file. Something like this and preferable sorted too so I can see which ports were used most often:
.80: - 54513
.110: - 12334
.445: - 412