Skip to content

Instantly share code, notes, and snippets.

@asakasinsky
Last active August 29, 2015 14:04
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 asakasinsky/bcd9f0b429299d2b24e1 to your computer and use it in GitHub Desktop.
Save asakasinsky/bcd9f0b429299d2b24e1 to your computer and use it in GitHub Desktop.
Gather Unique User-Agents from access_log
#!/bin/bash
# GUAFAL
# Gather User-Agents From Access Log
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$1" == "" ]; then
echo "Sorry, i need an access_log path."
exit 1
fi
FILE=$1
if [ ! -f $FILE ];
then
echo "access_log '$FILE' does not exist."
fi
awk -F'"' '/GET/ {print $6}' $FILE| sort -u >> $WORK_DIR/user-agents.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment