Skip to content

How to perform an replace-only update of a multidoc file #816

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

You must be logged in to vote

You just need to filter out the nodes that don't have .a.b on the LHS of the update operator:

yq e '(select(.a.b) | .a.b) = 10' examples/data1.yaml

Replies: 2 comments 3 replies

Comment options

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

Answer selected by BrendanGalloway
Comment options

You must be logged in to vote
2 replies
@mikefarah
Comment options

@infa-ddeore
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants