From 1bb613262021b1a7452ddf2c1feaaedbae404c27 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Mon, 29 Aug 2022 10:22:32 +1000 Subject: [PATCH] improved v3 merge docs --- upgrading-from-v3.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/upgrading-from-v3.md b/upgrading-from-v3.md index 118b822b..364b8300 100644 --- a/upgrading-from-v3.md +++ b/upgrading-from-v3.md @@ -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.