cat data/ann.json | jq '.metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) | from_entries' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "kuku" }, { "key": "label2", "value": "kuku" }, { "key": "label3", "value": "kuku" } ] |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "kuku", "label2": "kuku", "label3": "kuku" } |