Skip to content

Instantly share code, notes, and snippets.

@psd
Last active May 19, 2017 16:17
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 psd/da5b5247511536d23b6b5e77ee0957d9 to your computer and use it in GitHub Desktop.
Save psd/da5b5247511536d23b6b5e77ee0957d9 to your computer and use it in GitHub Desktop.
#!/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