-
-
Save tuantranf/92520a990c9503b7718d9b7e281a1838 to your computer and use it in GitHub Desktop.
One liner for counting unique IP addresses from nginx logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One liner for counting unique IP addresses from nginx logs | |
# Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!) | |
# | |
# Sample output: | |
# | |
# $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' | |
# 66.65.145.220 49 | |
# 92.63.28.68 126 | |
cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment