Last active
May 19, 2017 16:17
-
-
Save psd/da5b5247511536d23b6b5e77ee0957d9 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# 10 /government/uploads/system/uploads/attachment_data/file/98864/thumbnail_emr-2010-11.pdf.png GET 200 origin,2 | |
find daily -type d -name '20??????' | | |
while read dir | |
do | |
date=$(echo "$dir" | sed -e 's/^.*\(20[0-9]*\).*$/\1/') | |
zcat $dir/count_cdn-govuk.log-20*.csv.gz | | |
sed -e 's/^[0-9][0-9] //' \ | |
-e '/^\/government\/uploads\/system\/uploads\/attachment_data\/file\//!d' \ | |
-e 's/^.*\/file\/\([^ ]*\).*,\([0-9]*\).*$/\1 \2/' \ | |
-e '/\.png/d' | | |
awk '{ count[$1] += $2 } | |
END { for (key in count) { | |
print "'"$date"'\t" key "\t" count[key] | |
}}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment