I have a file in the format as follows:
$ cat file.txt 18.104.22.168 22.214.171.124 126.96.36.199 188.8.131.52 184.108.40.206 220.127.116.11 18.104.22.168
What's the best way to parse the file
file.txt into a format like:
22.214.171.124: 2 126.96.36.199: 1 188.8.131.52: 1 184.108.40.206: 3
In other words, I want to loop through the file and count the number of times each IP address appears. I've already run it through
sort so all the IP addresses are in order and directly after each other.