yq/operators/union.md

34 lines
354 B
Markdown
Raw Normal View History

2021-10-30 03:14:39 +00:00
# Union
This operator is used to combine different results together.
## Combine scalars
Running
```bash
2022-01-28 01:45:43 +00:00
yq --null-input '1, true, "cat"'
2021-10-30 03:14:39 +00:00
```
will output
```yaml
1
true
cat
```
## Combine selected paths
Given a sample.yml file of:
```yaml
a: fieldA
b: fieldB
c: fieldC
```
then
```bash
2022-01-28 01:45:43 +00:00
yq '.a, .c' sample.yml
2021-10-30 03:14:39 +00:00
```
will output
```yaml
fieldA
fieldC
```
2021-11-03 04:00:28 +00:00