Skip to content

Instantly share code, notes, and snippets.

@davaymne
Created December 13, 2020 19:01
Show Gist options
  • Save davaymne/5c6eb9fa20ad1e8b5a0655786eeb359a to your computer and use it in GitHub Desktop.
Save davaymne/5c6eb9fa20ad1e8b5a0655786eeb359a to your computer and use it in GitHub Desktop.
# Consumes json summary file
# output call count per subgraph
summaries=""
day=2020115
day_summary=$(jq -s 'group_by(.subgraph) |
map({"subgraph":(.[0].subgraph), "calls":(reduce .[].calls as $calls (0; . + $calls)), "date":("'$day'") }) |
map([.subgraph, .calls, .date] | join(", ")) | join(" \r\n ")' < $1)
summaries+="${day_summary//\"} \r\n"
printf "${summaries//\"}" > subgraph_daily_summary.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment