Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Created August 11, 2021 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojenzaman/2a20c0f870e15a69f004bd8d8fa86341 to your computer and use it in GitHub Desktop.
Save rojenzaman/2a20c0f870e15a69f004bd8d8fa86341 to your computer and use it in GitHub Desktop.
Count IP address in Nginx access logs
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: `basename $0` <access.log>"
exit 1
fi
awk '{print $1}' "${1}" | sort | uniq -c | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment