How to remove map entries from selected nested maps properties #2343
-
Hi yq community, I have a question here. I have a yaml file looks kind of like this:
My objective is to remove the duplicated properties in the top properties section if the field section has already contain the same properties. My desire output:
How do I do this with yq? I've tried multiple approaches with I'd really appreciate it if someone could figure out any working approaches. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
so the closest approach I came about is
but I still need to specify the string array. Is there a way that I can plug I tried
but that didn't work for me. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
with(.. | select(kind == "map" and .type == "object"); <<exp>>
will iterate over everytype: object
node([.field[].properties | keys] | flatten )
and save that as$k
.properties |= omit($k)