Jq: Add option to not print records where the query would result in "null"

Created on 22 Oct 2012  ·  3Comments  ·  Source: stedolan/jq

Throwing "grep -v null" on the end of the command is easy enough, but in many (most?) situations where i'm doing a query on a field name, I don't want records where the query would result in a non-match on the record.

feature request

Most helpful comment

Alternately:
jq '.foo // empty

All 3 comments

jq 'foo | select(. == null | not)'

should do the trick

Hmm, it seems like it would be simpler to use a general command line option for a wider, more common use case of not wanting any nulls in output.

Alternately:
jq '.foo // empty

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kelchy picture kelchy  ·  4Comments

lhunath picture lhunath  ·  3Comments

lbrader picture lbrader  ·  3Comments

jfeist picture jfeist  ·  4Comments

neowulf picture neowulf  ·  3Comments