String Operators

Join strings

Given a sample.yml file of:

- cat
- meow
- 1
- null
- true

then

yq eval 'join("; ")' sample.yml

will output

cat; meow; 1; ; true

Split strings

Given a sample.yml file of:

cat; meow; 1; ; true

then

yq eval 'split("; ")' sample.yml

will output

- cat
- meow
- "1"
- ""
- "true"

Split strings one match

Given a sample.yml file of:

word

then

yq eval 'split("; ")' sample.yml

will output

- word