mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Updating merge docs
This commit is contained in:
parent
fbe49c3700
commit
451d8643ee
@ -28,3 +28,9 @@ Note the use of `eval-all` to ensure all documents are loaded into memory.
|
|||||||
```bash
|
```bash
|
||||||
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Merging complex arrays together by a key field
|
||||||
|
By default - `yq` merge is naive. It merges maps when they match the key name, and arrays are merged either by appending them together, or merging the entries by their position in the array.
|
||||||
|
|
||||||
|
For more complex array merging (e.g. merging items that match on a certain key) please see the example [here](https://mikefarah.gitbook.io/yq/operators/multiply-merge#merge-arrays-of-objects-together-matching-on-a-key)
|
||||||
|
|
||||||
|
@ -29,6 +29,12 @@ Note the use of `eval-all` to ensure all documents are loaded into memory.
|
|||||||
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
yq eval-all '. as $item ireduce ({}; . * $item )' *.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Merging complex arrays together by a key field
|
||||||
|
By default - `yq` merge is naive. It merges maps when they match the key name, and arrays are merged either by appending them together, or merging the entries by their position in the array.
|
||||||
|
|
||||||
|
For more complex array merging (e.g. merging items that match on a certain key) please see the example [here](https://mikefarah.gitbook.io/yq/operators/multiply-merge#merge-arrays-of-objects-together-matching-on-a-key)
|
||||||
|
|
||||||
|
|
||||||
{% hint style="warning" %}
|
{% hint style="warning" %}
|
||||||
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
|
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user