mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-15 07:38:14 +00:00
50 lines
582 B
Markdown
50 lines
582 B
Markdown
This operator is used to combine different results together.
|
|
## Examples
|
|
### Combine scalars
|
|
Running
|
|
```bash
|
|
yq eval --null-input '1, true, "cat"'
|
|
```
|
|
will output
|
|
```yaml
|
|
1
|
|
true
|
|
cat
|
|
```
|
|
|
|
### Combine selected paths
|
|
Given a sample.yml file of:
|
|
```yaml
|
|
a: fieldA
|
|
b: fieldB
|
|
c: fieldC
|
|
```
|
|
then
|
|
```bash
|
|
yq eval '.a, .c' sample.yml
|
|
```
|
|
will output
|
|
```yaml
|
|
fieldA
|
|
fieldC
|
|
```
|
|
|
|
### Combine selected paths
|
|
Given a sample.yml file of:
|
|
```yaml
|
|
a: fieldA
|
|
b: fieldB
|
|
c: fieldC
|
|
```
|
|
then
|
|
```bash
|
|
yq eval '(.a, .c) |= "potatoe"' sample.yml
|
|
```
|
|
will output
|
|
```yaml
|
|
a: potatoe
|
|
b: fieldB
|
|
c: potatoe
|
|
```
|
|
|