Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save apotek/78a8789fbb7d8d96a86e2cb8884f3410 to your computer and use it in GitHub Desktop.
Save apotek/78a8789fbb7d8d96a86e2cb8884f3410 to your computer and use it in GitHub Desktop.
# Get a list of the top level keys in a yaml file suitable for shell loop
yq e '(. | keys)[]' example.yaml
# Example:
# for key in $(yq e '(. | keys)[]' example.yaml); do
# echo $key
# done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment