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:

a: cat
b: bob

then

yq '.b | column' sample.yml

will output

4

Returns column of key node

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

Given a sample.yml file of:

a: cat
b: bob

then

will output

First column is 1

Given a sample.yml file of:

then

will output

No column data is 0

Running

will output

Last updated

Was this helpful?