2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00

Add a jq filter example

This commit is contained in:
Tom Vincent 2020-02-08 12:26:52 +00:00 committed by GitHub
parent 44d15abd8d
commit 1ba369f630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,3 +82,10 @@ jq -r '(map(keys) | add | unique | sort) as $cols | .[] as $row | $cols | map($r
# #
# => 2,,1 # => 2,,1
# ,4,3 # ,4,3
# Filter a list of objects
jq 'map(select(.name == "foo"))'
#
# [ { "name": "foo" }, { "name": "bar" } ]
# => [ { "name": "foo" } ]