filtering data using parameters

后端 未结 2 1499
陌清茗
陌清茗 2021-01-25 07:18

I have this command that is working..

cat  ~/Desktop/results.json |  jq \'.[] | .environmentStatuses[].deploymentResult | select(.key.entityKey.key==\"39583746-3         


        
2条回答
  •  时光取名叫无心
    2021-01-25 07:55

    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
    

提交回复
热议问题