Skip to content
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