Skip to content

Instantly share code, notes, and snippets.

@diegov
Created November 21, 2020 19:16
Show Gist options
  • Save diegov/dbefedadf6ad3dcfbf927ba9111adc5f to your computer and use it in GitHub Desktop.
Save diegov/dbefedadf6ad3dcfbf927ba9111adc5f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
filter="$1"
shift
jq -r '
def normalise:
. as $in
| if type == "number" then
"[]"
else
.
end;
paths
| map(normalise)
| select(.[-1] | tostring | test($filter; "i"))
| join("->")
' --arg filter "$filter" "$@" | sort | uniq -c | sort -n -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment