I’m doing something like
zgrep “somepattern” access_log.X.gz
But I find that a lot of the entries are from the same IP and I’d like to count them as one.
I’m doing something like zgrep somepattern access_log.X.gz But I find that a lot of
Share
I would use something like
awkis to print out the field that contains the client IP address (I’m assuming it’s the third field here, but adjust the number to match your log format), thensort -usorts the IP addresses and removes duplicates, thenwc -lcounts the number of lines.