mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-14 12:35:35 +00:00
improved v3 merge docs
This commit is contained in:
parent
dcab9032d6
commit
1bb6132620
@ -118,12 +118,14 @@ yq 'del(.a.b.c)' sample.yaml
|
||||
|
||||
### Merging documents
|
||||
|
||||
Like `jq`, merge is done via the multiply operator. You will need to use the eval-all command to load all documents into memory at once, and then use the file operator to select the file nodes to merge.
|
||||
Like `jq`, merge is done via the multiply operator.
|
||||
|
||||
```bash
|
||||
yq eval-all 'select(fileIndex == 0) * select(filename == "file2.yaml")' file1.yaml file2.yaml
|
||||
yq '. * load("file2.yaml")' file1.yaml
|
||||
```
|
||||
|
||||
See the [multiply documentation](https://mikefarah.gitbook.io/yq/operators/multiply-merge) for more example and options.
|
||||
|
||||
### Prefix yaml
|
||||
|
||||
Use the [Create / Collect Into Object ](broken-reference)operator to create a new object with the desired prefix. 
|
||||
|
Loading…
Reference in New Issue
Block a user