Last active
October 9, 2025 15:49
-
Star
(200)
You must be signed in to star a gist -
Fork
(24)
You must be signed in to fork a gist
-
-
Save ipbastola/2c955d8bf2e96f9b1077b15f995bdae3 to your computer and use it in GitHub Desktop.
Revisions
-
ipbastola revised this gist
Oct 24, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ## JQ to filter JSON by value Syntax: <strong>`cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'`</strong> Example: To get json record having _id equal 611 ```bash -
ipbastola revised this gist
Oct 24, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ## JQ to filter JSON by value Syntax: <strong>cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'</strong> Example: To get json record having _id equal 611 ```bash -
ipbastola created this gist
Oct 24, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ ## JQ to filter JSON by value Syntax: *cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'* Example: To get json record having _id equal 611 ```bash cat my.json | jq -c '.[] | select( ._id | contains(611))' ``` Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in `contains(611)`