> For the complete documentation index, see [llms.txt](https://mikefarah.gitbook.io/yq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mikefarah.gitbook.io/yq/operators/split-into-documents.md).

# Split into Documents

This operator splits all matches into separate documents

## Split empty

Running

```bash
yq --null-input 'split_doc'
```

will output

```yaml
```

## Split array

Given a sample.yml file of:

```yaml
- a: cat
- b: dog
```

then

```bash
yq '.[] | split_doc' sample.yml
```

will output

```yaml
a: cat
---
b: dog
```
