Skip to content

Instantly share code, notes, and snippets.

@yokawasa
Last active May 31, 2022 20:29
Show Gist options
  • Save yokawasa/5e843554c610039a13d9e0d76d4b8ab1 to your computer and use it in GitHub Desktop.
Save yokawasa/5e843554c610039a13d9e0d76d4b8ab1 to your computer and use it in GitHub Desktop.
jq filter snippets

jq filter snippets

snippets

cat <file> | jq -c '.[] | select( .<key> | contains("<value>"))'

cat <file> | jq '.items[0]' 

cat <file> | jq '.items[0] | select( .number == 3555 )'

# filter and get specific fields ( url and title)
cat <file> | jq '.items[0] |  select( .number == 3555 ) | .url,.title'

references

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