mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
32 lines
336 B
Markdown
32 lines
336 B
Markdown
# 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
|
|
```
|
|
|