Skip to content

Instantly share code, notes, and snippets.

@agail
Created December 13, 2021 15:56
Show Gist options
  • Save agail/a400c6ef0e379a9baf340537afb67ca9 to your computer and use it in GitHub Desktop.
Save agail/a400c6ef0e379a9baf340537afb67ca9 to your computer and use it in GitHub Desktop.
jq version differences

Search if a key contains "myStr"

v1.4:

jq -r --arg str "myStr" '.objects[]|select(.name|contains($str))|"\(.name) \(.type)"'

v1.6:

jq -r --arg str "myStr" '.objects[]|select(.name|test($str))|"\(.name) \(.type)"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment