yq — YAML Processing

YAML processing with yq across 9 disciplines. Uses jq-compatible syntax for YAML files. All commands copy-paste-runnable against real files in this repository and standard infrastructure YAML.

Disciplines

Discipline Description

Basics

Key access, nested paths, scalar values, array traversal, length, keys, type inspection

Selection

select, test, has, to_entries filtering, map(select()), regex on keys and values

Transforms

to_entries/from_entries, map, with_entries, sort_by, group_by, unique_by, flatten

Editing

In-place edit (-i), add/delete/update keys, merge files, set values, array manipulation

Output

Raw output, compact JSON, format conversion (JSON/XML/CSV/TSV/props), format strings, @base64

Antora

antora.yml auditing, attribute inspection, nav parsing, playbook queries, cross-repo comparison

Infrastructure

systemd inventories, docker-compose, Kubernetes manifests, Helm values, cloud-init

Gotchas

Dotted keys, !!null, string vs number, yq vs jq differences, credential safety, YAML anchors

Multi-Document

Document index, select documents, split/merge multi-doc YAML, front matter extraction

See Also

  • jq — JSON counterpart (identical syntax)

  • jq Text Processing — fundamentals shared by both tools