> 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/column.md).

# Column

Returns the column of the matching node. Starts from 1, 0 indicates there was no column data.

Column is the number of characters that precede that node on the line it starts.

## Returns column of *value* node

Given a sample.yml file of:

```yaml
a: cat
b: bob
```

then

```bash
yq '.b | column' sample.yml
```

will output

```yaml
4
```

## Returns column of *key* node

Pipe through the key operator to get the column of the key

Given a sample.yml file of:

```yaml
a: cat
b: bob
```

then

```bash
yq '.b | key | column' sample.yml
```

will output

```yaml
1
```

## First column is 1

Given a sample.yml file of:

```yaml
a: cat
```

then

```bash
yq '.a | key | column' sample.yml
```

will output

```yaml
1
```

## No column data is 0

Running

```bash
yq --null-input '{"a": "new entry"} | column'
```

will output

```yaml
0
```
