Skip to content

Filter out direct child objects whose key doesn't match a specific value #809

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

You must be logged in to vote

In the latest 4.8.0 release you can now do this:

yq e '.environment |= with_entries(select(.key=="prod"))' 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sguillope
Comment options

@mikefarah
Comment options

@mikefarah
Comment options

@sguillope
Comment options

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