mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
804 B
804 B
Examples
Example 0
Given a sample.yml file of:
a: cat
then
yq eval '.a style="single"' sample.yml
will output
{a: 'cat'}
Set style using a path
Given a sample.yml file of:
a: cat
b: double
then
yq eval '.a style=.b' sample.yml
will output
{a: "cat", b: double}
Example 2
Given a sample.yml file of:
a: cat
b: dog
then
yq eval '.. style=""' sample.yml
will output
a: cat
b: dog
Example 3
Given a sample.yml file of:
a: cat
b: thing
then
yq eval '.. | style' sample.yml
will output
flow
double
single
Example 4
Given a sample.yml file of:
a: cat
then
yq eval '.. | style' sample.yml
will output