Skip to content

Instantly share code, notes, and snippets.

@spyesx
spyesx / yq-command-full-path-from-key-name.md
Last active October 27, 2025 09:36
yq command to find the full path by a key name (using the go implementation by mikefarah/yq)

yq command to find the full path by a key name – (using the go implementation by mikefarah/yq)

TL;DR

yq '.. | select(tag != "!!map" and tag != "!!seq" and (parent | key) == "<keyname>") | path | join(".")' \
 <filename.yaml>

Example