Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Created December 11, 2015 22:50
Show Gist options
  • Save tlrobinson/b7bcb9fd4b8d736ad76b to your computer and use it in GitHub Desktop.
Save tlrobinson/b7bcb9fd4b8d736ad76b to your computer and use it in GitHub Desktop.
curl -O https://raw.githubusercontent.com/hackclub/metrics/master/slack_stats.tsv
awk 'NR==1 { for (i=2;i<=NF;i++) x[i] = $i } NR!=1 {for (i=2;i<=NF;i++) print $1"\t"x[i]"\t"$i}' slack_stats.tsv > slack_stats_unpivoted.tsv
sqlite3 slack_stats.sqlite3 <<EOF
create table slack_stats (user text, date text, count int);
.separator "\t"
.import slack_stats_unpivoted.tsv slack_stats
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment