Skip to content
Discussion options

You must be logged in to vote

The expression you have at the moment is basically calculating A op B, and returning the result of that (e.g. 3 x 4). Whereas what you actually want to do is update each element of root with that value.

To do that, you need to:

yq eval-all '(select(fi == 0).root.[] *= select(fi == 1).defaults) | select(fi==0)' file1.yaml file2.yaml

Alternatively, you can use the new load operator which simplifies this a little:

yq '.root[] *= (load("data2.yaml") | .defaults)' data1.yaml

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by msmolka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants