Skip to content

Instantly share code, notes, and snippets.

@dezgeg
Created October 15, 2014 01:02
Show Gist options
  • Save dezgeg/c07764e189180b215832 to your computer and use it in GitHub Desktop.
Save dezgeg/c07764e189180b215832 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd "$(dirname "$0")"
if ! [ -f csv.zip ]; then
echo "Downloading data." >&2
wget http://pilvilinna.cert.fi/opendata/autoreporter/csv.zip
fi
echo "Incident category frequencies:"
unzip -c csv.zip 2>/dev/null | grep -v '^#' | cut -d'|' -f6 | sort | uniq -c | perl -pe 's/^ *(\d+) (.*)$/$2 $1/'
echo "Location frequencies:"
unzip -c csv.zip 2>/dev/null | grep -v '^#' | cut -d'|' -f8-9 | sort | uniq -c | perl -pe 's/^ *(\d+) (.*)$/$2 $1/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment