diff --git a/mkdocs/read.md b/mkdocs/read.md index ad84220..ca52699 100644 --- a/mkdocs/read.md +++ b/mkdocs/read.md @@ -32,6 +32,8 @@ bob: cats: bananas item2: cats: apples + thing: + cats: oranges ``` then ```bash @@ -41,6 +43,29 @@ will output ```yaml - bananas - apples +- oranges +``` + +### Prefix Splat +Given a sample.yaml file of: +```yaml +--- +bob: + item1: + cats: bananas + item2: + cats: apples + thing: + cats: oranges +``` +then +```bash +yq r sample.yaml bob.item*.cats +``` +will output +```yaml +- bananas +- apples ``` ### Multiple Documents - specify a single document diff --git a/mkdocs/write.md b/mkdocs/write.md index fd8dbbc..d06feaa 100644 --- a/mkdocs/write.md +++ b/mkdocs/write.md @@ -43,6 +43,62 @@ b: - new thing ``` +### Splat +Given a sample.yaml file of: +```yaml +--- +bob: + item1: + cats: bananas + item2: + cats: apples + thing: + cats: oranges +``` +then +```bash +yq w sample.yaml bob.*.cats meow +``` +will output: +```yaml +--- +bob: + item1: + cats: meow + item2: + cats: meow + thing: + cats: meow +``` + +### Prefix Splat +Given a sample.yaml file of: +```yaml +--- +bob: + item1: + cats: bananas + item2: + cats: apples + thing: + cats: oranges +``` +then +```bash +yq w sample.yaml bob.item*.cats meow +``` +will output: +```yaml +--- +bob: + item1: + cats: meow + item2: + cats: meow + thing: + cats: oranges +``` + ### Appending value to an array field Given a sample.yaml file of: ```yaml