Traverse (Read)
This is the simplest (and perhaps most used) operator. It is used to navigate deeply into yaml structures.
Given a sample.yml file of:
a:
b: apple
then
yq '.a' sample.yml
will output
b: apple
Often used to pipe children into other operators
Given a sample.yml file of:
- b: apple
- c: banana
then
yq '.[]' sample.yml
will output
b: apple
c: banana
Just like splat, but won't error if you run it against scalars
Given a sample.yml file of:
cat
then
yq '.[]' sample.yml
will output