Skip to content

Instantly share code, notes, and snippets.

@hellwolf
Last active February 19, 2019 14:19
Show Gist options
  • Save hellwolf/8e1c2097d3d4529afac3151ed0cd9c8a to your computer and use it in GitHub Desktop.
Save hellwolf/8e1c2097d3d4529afac3151ed0cd9c8a to your computer and use it in GitHub Desktop.
jq sort truffle contract json artifact
jq -r '[
. as $root | keys[] as $k | $root[$k] | @json | length as $len | { key: $k, length: $len }
] | sort_by(.length) | reverse | map("\(.key) \(.length)")[]' $CONTRACT_JSON_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment