Reduce
Last updated
yq '.[] as $item ireduce (0; . + $item)' sample.yml20a: catb: dogyq eval-all '. as $item ireduce ({}; . * $item )' sample.yml another.ymla: cat
b: dog- name: Cathy
has: apples
- name: Bob
has: bananasyq '.[] as $item ireduce ({}; .[$item | .name] = ($item | .has) )' sample.ymlCathy: apples
Bob: bananas