Skip to content

Instantly share code, notes, and snippets.

@int13h
Created November 6, 2014 18:11
Show Gist options
  • Save int13h/46e493b50465240e300c to your computer and use it in GitHub Desktop.
Save int13h/46e493b50465240e300c to your computer and use it in GitHub Desktop.
#!/usr/local/bin/bash
n=$#
if [ $n -gt 1 ]; then
date=$1
format=$2
case "$format" in
1) zcat $date/http.* | gawk '{print strftime("%Y-%m-%d %T", $1),$3,$9$10}'
;;
2) zcat $date/http.* | gawk '{print strftime("%Y-%m-%d %T", $1),$9}'
;;
3) zcat $date/http.* | gawk '{print strftime("%Y-%m-%d %T", $1),$3,$9}'
;;
4) zcat $date/http.* | awk '{print $9}' | awk -F "." '{print $(NF-1)"."$NF}' | sort | uniq -c | sort -r | awk '{print $2,$1}'
;;
5) zcat $date/http.* | gawk '{print strftime("%H:%M", $1)}' | sort | uniq -c | awk '{print $2","$1}'
;;
6) zcat $date/http.* | gawk '{print strftime("%Y-%m-%d %T", $1),$9}'
;;
esac
else
echo
echo "Usage: $0 <date: 2001-08-18> <format: 1 - 6>"
echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment