Skip to content

how to add part of a.yaml to b.yaml #1674

Answered by mikefarah
caibirdme asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the 'load' operator to load content from another file:

yq '.qq.we += (load("a.yaml") | .foo.bar)' b.yaml

Explanation:

  • You want to add '.foo.bar' in file a.yaml to '.qq.we' in b.yaml
  • Run yq again b.yaml
  • (load("a.yaml") | .foo.bar) will load a.yaml and navigate to .foo.bar

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@caibirdme
Comment options

Answer selected by caibirdme
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