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

sloanlance picture sloanlance  路  3Comments

jfeist picture jfeist  路  4Comments

lhunath picture lhunath  路  3Comments

thelonious picture thelonious  路  4Comments

kaihendry picture kaihendry  路  4Comments