convert and transform YAML documents in shell scripts using yq v4's eval expression syntax

domain: mikefarah.gitbook.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Run a read/transform expression against a file with `yq eval '.a.b.c' file.yaml` (or the shorthand `yq e`), using jq-like path/pipe syntax rather than yq v3's flag-based CLI.
  2. Update a value in place with an assignment expression, e.g. `yq eval '.a.b.c = "newvalue"' -i file.yaml`, where -i edits the file in place.
  3. Filter or select elements with select(...), e.g. `yq eval '.a.b.c | select(. == "cat")' file.yaml`, mirroring jq's filtering idiom.
  4. Evaluate an expression built dynamically at runtime (e.g., from an environment variable) using the eval(...) operator inside a larger expression, rather than string-interpolating shell variables directly into the yq expression.
  5. Process multiple files together with `yq eval-all` (aliased `yq ea`) when a transformation needs to see more than one document at once, since plain eval processes documents independently.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans