Skip to content

Instantly share code, notes, and snippets.

@aras-p
Last active May 31, 2019 08:15
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 aras-p/4067c7677f48086743607ea2835b6a79 to your computer and use it in GitHub Desktop.
Save aras-p/4067c7677f48086743607ea2835b6a79 to your computer and use it in GitHub Desktop.
Using jq to manipulate build DAG json
cat artifacts/tundra/${1}.dag1.json | ./jq-osx-amd64 ".Nodes[] | {ann: .Annotation, act: (try .Action catch \"\"|split(\" \")|unique), txt: (try .WriteTextFilePayload catch \"foo\"|split(\" \")|map(split(\",\")|map(split(\"\\n\")))|add|add|unique), inp:.Inputs|unique}" >artifacts/_/${1}.dag1.json
cat artifacts/tundra/${1}.dag.json | ./jq-osx-amd64 ".Nodes[] | {ann: .Annotation, act: (try .Action catch \"\"|split(\" \")|unique), txt: (try .WriteTextFilePayload catch \"foo\"|split(\" \")|map(split(\",\")|map(split(\"\\n\")))|add|add|unique), inp:.Inputs|unique}" >artifacts/_/${1}.dag.json
diff -Naur artifacts/_/${1}.dag1.json artifacts/_/${1}.dag.json >artifacts/_/_${1}.diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment