I've got a huge textfile which contains IP addresses:
123.33.22.33
221.23.128.2
123.33.22.33
92.222.192.12
92.222.192.12
123.33.22.33
I can sort it to:
123.33.22.33
123.33.22.33
123.33.22.33
221.23.128.2
92.222.192.12
92.222.192.12
and see (with bare eye) that first IP occurs three times, second once, and last one twice.
I'd like to be able to do this in huge logfiles, obviously in an automated way. Is it possible?
thanks
will sort desc by ip counts, showing the counters on first column
e.g.
Once you have it sorted you can pipe it throu uniq -c
That'll tally the counts for you.
You can use uniq -c to get a count, but be sure to sort the input first or you'll only get counts of consecutive, alike lines:
I often then sort it by the lines with the most matches: