Skip to content

Instantly share code, notes, and snippets.

@prakhar1989
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save prakhar1989/9f2e25b6564b8411e159 to your computer and use it in GitHub Desktop.

Select an option

Save prakhar1989/9f2e25b6564b8411e159 to your computer and use it in GitHub Desktop.
filename=$1
for hour in {0..23}
do
for minute in {0..59}
do
if [ $hour -lt 10 ]
then
h="0$hour"
else
h=$hour
fi
if [ $minute -lt 10 ]
then
m="0$minute"
else
m=$minute
fi
result=$(zgrep "29/Jun/2014:$h:$m" $filename | awk '{print $1}' | sort -u | wc -l)
result="$h:$m, $result"
echo $result
done
done
@prakhar1989
Copy link
Author

Usage

$ wget file_url
$ chmod +x log.sh
$ ./log.sh m.xcite-access.log.6.gz  > web2_mobile.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment