1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Split doc operator

This commit is contained in:
Mike Farah
2021-01-14 14:25:31 +11:00
parent 02ef99560d
commit 626e9cacaf
8 changed files with 89 additions and 3 deletions

View File

@@ -0,0 +1,31 @@
# Split into Documents
This operator splits all matches into separate documents
## Split empty
Running
```bash
yq eval --null-input 'splitDoc'
```
will output
```yaml
```
## Split array
Given a sample.yml file of:
```yaml
- a: cat
- b: dog
```
then
```bash
yq eval '.[] | splitDoc' sample.yml
```
will output
```yaml
a: cat
---
b: dog
```

View File

@@ -0,0 +1,3 @@
# Split into Documents
This operator splits all matches into separate documents