1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Traverse Array Operator

This commit is contained in:
Mike Farah
2020-12-26 21:37:08 +11:00
parent ea231006ed
commit a88c2dc5d3
10 changed files with 357 additions and 201 deletions

View File

@@ -112,7 +112,7 @@ a:
```
then
```bash
yq eval '(.a.[] | select(. == "apple")) = "frog"' sample.yml
yq eval '(.a[] | select(. == "apple")) = "frog"' sample.yml
```
will output
```yaml

View File

@@ -366,3 +366,21 @@ bar_thing
foobarList_c
```
## Select multiple indices
Given a sample.yml file of:
```yaml
a:
- a
- b
- c
```
then
```bash
yq eval '.a[0, 2]' sample.yml
```
will output
```yaml
a
c
```