Closed alexpenev-s closed 5 months ago
When using with_entries
you have to perform the update within the brackets of that operator - not out.
To get what you want here, you'd need to do something like:
yq '.a |= with_entries(select(.key | test("b$")) | .value.c = "5504881")' examples/data1.yaml
a:
b:
c: "5504881"
Explanation:
|=
to update .a
, w.r.t to itselfwith_entries
to find the right key to update the value ofThank you
Version of yq: v4.44.1
Input Yaml data1.yml:
Command The command you ran:
Actual behavior
Expected behavior
Additional context with yq version 4.22.1 The replace is done corretly.