yq/pkg/yqlib/doc/operators/split-into-documents.md
2022-02-06 14:39:46 +11:00

482 B

Split into Documents

This operator splits all matches into separate documents

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

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

Split empty

Running

yq --null-input 'splitDoc'

will output


Split array

Given a sample.yml file of:

- a: cat
- b: dog

then

yq '.[] | splitDoc' sample.yml

will output

a: cat
---
b: dog