mirror of
https://gitee.com/mirrors_adrian-thurston/yq.git
synced 2026-01-15 07:53:35 +08:00
Update multiply docs
This commit is contained in:
@@ -15,9 +15,16 @@ You can control how objects are merged by using one or more of the following fla
|
||||
- `?` only merge _existing_ fields
|
||||
- `n` only merge _new_ fields
|
||||
|
||||
### Merging files
|
||||
|
||||
### Merge two files together
|
||||
This uses the load operator to merge file2 into file1.
|
||||
```bash
|
||||
yq '. *= load("file2.yml")' file1.yml
|
||||
```
|
||||
|
||||
### Merging all files
|
||||
Note the use of `eval-all` to ensure all documents are loaded into memory.
|
||||
|
||||
```bash
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' file1.yaml file2.yaml
|
||||
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
||||
```
|
||||
|
||||
@@ -15,11 +15,18 @@ You can control how objects are merged by using one or more of the following fla
|
||||
- `?` only merge _existing_ fields
|
||||
- `n` only merge _new_ fields
|
||||
|
||||
### Merging files
|
||||
|
||||
### Merge two files together
|
||||
This uses the load operator to merge file2 into file1.
|
||||
```bash
|
||||
yq '. *= load("file2.yml")' file1.yml
|
||||
```
|
||||
|
||||
### Merging all files
|
||||
Note the use of `eval-all` to ensure all documents are loaded into memory.
|
||||
|
||||
```bash
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' file1.yaml file2.yaml
|
||||
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
||||
```
|
||||
|
||||
{% hint style="warning" %}
|
||||
|
||||
Reference in New Issue
Block a user