mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-14 12:35:35 +00:00
Improved set path example
This commit is contained in:
parent
f64376da9b
commit
2926e1d9b1
@ -123,7 +123,7 @@ a:
|
||||
```
|
||||
|
||||
## Set path to extract prune deep paths
|
||||
Like pick but recursive.
|
||||
Like pick but recursive. This uses `ireduce` to deeply set the selected paths into an empty object,
|
||||
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
@ -137,7 +137,8 @@ parentC:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq '(.parentB.child2, .parentC.child1) as $i ireduce({}; setpath($i | path; $i))' sample.yml
|
||||
yq '(.parentB.child2, .parentC.child1) as $i
|
||||
ireduce({}; setpath($i | path; $i))' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
|
Loading…
Reference in New Issue
Block a user