> For the complete documentation index, see [llms.txt](https://mikefarah.gitbook.io/yq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mikefarah.gitbook.io/yq/operators/union.md).

# Union

This operator is used to combine different results together.

## Combine scalars

Running

```bash
yq --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 '.a, .c' sample.yml
```

will output

```yaml
fieldA
fieldC
```
