mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
369 B
369 B
Keys
Use the keys
operator to return map keys or array indices.
Map keys
Given a sample.yml file of:
dog: woof
cat: meow
then
yq eval 'keys' sample.yml
will output
- dog
- cat
Array keys
Given a sample.yml file of:
- apple
- banana
then
yq eval 'keys' sample.yml
will output
- 0
- 1