Earlier today, I was analysing some logs, and wanted to count the number of times each IP address occured within these logs, and then have the IP address next to the number of times it appeared (thereby assisting in recognising the biggest visitors). I started off with Apache logs, so to get the list of IP address from all files into one *long* list, I just did this:
cat * | awk '{print $1}' > ip_access_list
Then, to do the actual counting, I did the following:
sort ip_access_list | uniq -c | sort -nr