Useful notes about using yq
-
Display the path to each value in a YAML file
$ cat << EOF | yq e '.. | select(. == "*") | {(path | join(".")): .} ' - > a: > b: foo > c: bar > EOF a.b: foo a.c: bar
Explanation…
..
recursively select all valuesselect(. == "*")
filter for scalar values (i.e. filter out the value ofa
)(path | join("."))
gets the path as array and joins the elements with.
{…: .}
create a mapping, having the joined paths as keys and their values as values