yq/operators/pipe.md
2022-02-06 14:41:27 +11:00

554 B

Pipe

Pipe the results of an expression into another. Like the bash operator.

{% hint style="warning" %} Note that versions prior to 4.18 require the 'eval/e' command to be specified.

yq e <exp> <file> {% endhint %}

Simple Pipe

Given a sample.yml file of:

a:
  b: cat

then

yq '.a | .b' sample.yml

will output

cat

Multiple updates

Given a sample.yml file of:

a: cow
b: sheep
c: same

then

yq '.a = "cat" | .b = "dog"' sample.yml

will output

a: cat
b: dog
c: same