I have a file that looks like this:
192.168.2.2 150.25.45.7 8080 192.168.12.25 178.25.45.7 50 192.168.2.2 142.55.45.18 369 192.168.489.2 122.25.35.7 8080 192.168.489.2 90.254.45.7 80 192.168.2.2 142.55.45.18 457
I made up all the numbers.
I need to sort all these files according to the number of repetitions of the first ip. Thus, the result ideally looks like this:
192.168.2.2 8080 369 457 3 192.168.489.2 8080 80 2 192.168.12.25 50 1
So: first ip, all ports that were in lines with the first ip, and the number of retries.
I tried to play with the sort and awk command, but I donβt want to do the extra work and maybe I am not missing out on some other direct solution.
Any idea? Thanks:)
source share