1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env bash set -o errexit -o nounset _jq() { jq --sort-keys ' (. | with_entries( if ( .value | has("hosts")) then (.value.hosts |= sort) end )) ' "$@" } diff -u --ignore-matching-lines '.*"timestamp":.*' <(_jq "${1:?error}") <(_jq "${2:?error}")