Traverse Array Operator

This commit is contained in:
Mike Farah
2020-12-27 22:48:20 +11:00
parent ea231006ed
commit a88c2dc5d3
10 changed files with 357 additions and 201 deletions
+1 -1
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
+18
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
```