yq/pkg/yqlib/doc/Union.md

31 lines
354 B
Markdown
Raw Permalink Normal View History

2020-11-17 23:32:30 +00:00
This operator is used to combine different results together.
2020-11-22 02:16:54 +00:00
## Combine scalars
2020-11-17 23:32:30 +00:00
Running
```bash
yq eval --null-input '1, true, "cat"'
```
will output
```yaml
1
true
cat
```
2020-11-22 02:16:54 +00:00
## Combine selected paths
2020-11-17 23:32:30 +00:00
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
```