Skip to content

Instantly share code, notes, and snippets.

@symbiont-eric-torreborre
Created April 13, 2020 11:19
Show Gist options
  • Save symbiont-eric-torreborre/279f73cb8741b2149c6ed390e433008a to your computer and use it in GitHub Desktop.
Save symbiont-eric-torreborre/279f73cb8741b2149c6ed390e433008a to your computer and use it in GitHub Desktop.
update snapshot files with jq
# remove publish payloads for versions 1-5
for i in {1..5}; do cat $i.json | jq -c '.channelActionAndSequencedTransaction |= map(select(.[1].contents[4].tag != "Publish"))' | jq --indent 4 . > $i-x.json; rm $i.json; mv $i-x.json $i.json; done
# remove publish payloads for version 6
for i in {6..6}; do cat $i.json | jq -c '.channelActionAndSequencedTransaction |= map(select(.[2][4].tag != "Publish"))' | jq --indent 4 . > $i-x.json; rm $i.json; mv $i-x.json $i.json; done
# remove publish payloads for versions 7-8
for i in {7..8}; do cat $i.json | jq -c '.channelActionAndSequencedTransaction |= map(select(.[2].wcaChannelAction.tag? != "Publish"))' | jq --indent 4 . > $i-x.json; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment