-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjq command
17 lines (8 loc) · 895 Bytes
/
jq command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cat <json file> or json output from any command | jq --raw-output '.<first column>|.<second column>|select ( .<thirdcolumn> == "column element")'
add a ? after <first column> if you want to check if a column exists
cat <json file> or json output from any command | jq --raw-output '.<first column>?|.<second column>|select ( .<thirdcolumn> == "column element")'
we can also select a column using below
cat <json file> or json output from any command | jq --raw-output '.<first column>.<second column>|select ( .<thirdcolumn> == "column element")'
if there is [] in json use [] in jq too
cat <json file> or json output from any command | jq --raw-output '.<first column>[]|.<second column>|select ( .<thirdcolumn> == "column element")' or
cat <json file> or json output from any command | jq --raw-output '.<first column>|.<second column>[]|select ( .<thirdcolumn> == "column element")'