Combining two files with fields overriding entirely on the other file. #1464
Unanswered
akshatdalton
asked this question in
Q&A
Replies: 1 comment
-
Yeah there's not way to do that (as far as I know) without explicitly doing what you had '.a.b.c = {"g": 3}'. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there, I'm new here. Thank you for making this amazing software.
I have a question that I want to resolve. (I hope this is the best place to ask, if not then please point it out to me.)
Suppose I have a file:
file1.yaml
with contents:and
file2.yaml
with contents:when I run:
yq eval-all '. as $item ireduce ({}; . * $item )' file2.yaml file1.yaml
, it outputs:But I want the fields present under
c
to complete change from the contents of thefile2.yaml
, i.e. I want the output to be:So, I want the values present under one field to completely change if the contents under that field is changed in another file 2.
I can achieve the same by doing:
yq '.a.b.c = {"g": 3}' file1.yaml
but I'm dealing with two files at a time and their contents are dynamic; their merge action should result in output something like above.Beta Was this translation helpful? Give feedback.
All reactions