Содержание

yq

https://github.com/mikefarah/yq

sudo wget -qO /usr/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/bin/yq

Примеры

merge

example

example

1.yaml:

file: 1
objects:
  first: 1
array:
  - 11
  - 12

2.yaml:

file: 2
objects:
  second: 2
array:
  - 21
  - 22


yq eval-all '. as $item ireduce ({} ; . * $item)' 1.yaml 2.yaml
#или
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' 1.yaml 2.yaml

output

output

file: 2
objects:
  first: 1
  second: 2
array:
  - 21
  - 22