From 1ba369f630c1fda7e9859bffc98c43d2063a057f Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sat, 8 Feb 2020 12:26:52 +0000 Subject: [PATCH] Add a jq filter example --- sheets/jq | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sheets/jq b/sheets/jq index ac4db23..05be235 100644 --- a/sheets/jq +++ b/sheets/jq @@ -82,3 +82,10 @@ jq -r '(map(keys) | add | unique | sort) as $cols | .[] as $row | $cols | map($r # # => 2,,1 # ,4,3 + +# Filter a list of objects +jq 'map(select(.name == "foo"))' +# +# [ { "name": "foo" }, { "name": "bar" } ] +# => [ { "name": "foo" } ] +