yq '.spec.template.spec.containers[0].image' deployment.yamlExcellent for scripts, CI jobs, and quick inspections.
High-value yq commands for reading, updating, filtering, converting, and merging YAML in local scripts and CI pipelines.
Extract values and slice nested structures from YAML files.
yq '.spec.template.spec.containers[0].image' deployment.yamlExcellent for scripts, CI jobs, and quick inspections.
yq '.features[]' config.yamlUseful for iterating over YAML sequences in shell scripts.
yq '.users[] | select(.role == "admin")' users.yamlA practical pattern when using YAML as config or fixture data.
yq -o=json '.' config.yamlHelpful when piping YAML into tools that only understand JSON.
Update files safely from scripts or release automation.
yq -i '.spec.template.spec.containers[0].image = "repo/api:v2"' deployment.yamlUseful for release pipelines that stamp manifests with a new image tag.
yq -i '.features += ["coach me"]' config.yamlA clean way to automate config changes without manual editing.
yq -i 'del(.metadata.annotations)' deployment.yamlHelpful when stripping environment-specific or generated data.
yq ea '. as $item ireduce ({}; . * $item )' base.yaml override.yamlCommon in layered configuration workflows.