-
I have been trying this for quite some time and I just cannot find a way or any hints how exactly to do it. catalog:
plans:
plan:
- +@name: personal-monthly
product: Personal
finalPhase:
recurring:
recurringPrice:
price:
value: "12.34"
- +@name: small-monthly
product: Small
finalPhase:
recurring:
recurringPrice:
price:
value: "34.56" Now, how to extract price's |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Nov 17, 2022
Replies: 2 comments
-
Sure thing: yq '.catalog.plans.plan[] | select(.product == "Personal") | .finalPhase.recurring.recurringPrice.price.value' file.yaml Explanation:
Hope it makes sense! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
arthef
-
Thanks a lot, works like a charm! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure thing:
yq '.catalog.plans.plan[] | select(.product == "Personal") | .finalPhase.recurring.recurringPrice.price.value' file.yaml
Explanation:
.catalog.plans.plan[]
- the[]
at the end recurses into all the array childrenselect(.product == "Personal")
Hope it makes sense!