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

benjamin-bin-shen picture benjamin-bin-shen  路  3Comments

ghost picture ghost  路  4Comments

rubensayshi picture rubensayshi  路  3Comments

tbelaire picture tbelaire  路  4Comments

thelonious picture thelonious  路  4Comments