Yq

From Christoph's Personal Wiki
Jump to: navigation, search

yq is a lightweight and portable command-line YAML, JSON and XML processor. yq uses jq like syntax but works with YAML files as well as JSON, XML, properties, csv and tsv.

Examples

$ yq -i '.spec.replicas=1' deployment/nginx/deploy.yml
$ yq -i '.spec.template.spec.containers[0].ports[0].containerPort=8080' deployment/nginx/deploy.yml
$ yq -i 'del(.resources[2])' deployment/nginx/kustomization.yml

External links