mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
751 B
751 B
Column
Returns the column of the matching node. Starts from 1, 0 indicates there was no column data.
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
yq '.b | key | column' sample.yml
will output
1
First column is 1
Given a sample.yml file of:
a: cat
then
yq '.a | key | column' sample.yml
will output
1
No column data is 0
Running
yq --null-input '{"a": "new entry"} | column'
will output
0