Skip to content
Anonymous edited this page Jan 6, 2013 · 2 revisions

Jq recipes

Examples to work with jq.

Basic field filtering

#show only product keys
veye search json --format=json | jq '.[] | .prod_key'

#show only package name and product's key
veye search json --format=json | jq '.[] | {name,prod_key}'

#turn response to csv
veye search json --format=json | jq '.[] | "\(.name), \(.prod_key)"'

#show only Java projects
veye search json --format=json | jq '.[] | select(.language ==  "Java")'

#show products and length of product name
veye search json --format=json | jq -c '.[] | .name | [., length] '
veye search json --format=json | jq -c '.[] | [{name: (.name) ,len: (.name | length)}]'
Clone this wiki locally