I have this command that is working..
cat ~/Desktop/results.json | jq \'.[] | .environmentStatuses[].deploymentResult | select(.key.entityKey.key==\"39583746-3
When trying to use extra parameters in your filters, use the --arg
option to pass them in. Don't rely on the shell to insert it into your filter string, keep that separate.
jq --arg key "$enkey" '.[] |
.environmentStatuses[].deploymentResult |
select(.key.entityKey.key == $key) |
.lifeCycleState' ~/Desktop/results.json
This worked for me :
jq '.[] | .environmentStatuses[].deploymentResult |
select(.key.entityKey.key == "'$key'") |
.lifeCycleState' ~/Desktop/results.json
--arg
does not works as expected ...