y
y
yq
Search…
y
y
yq
v4.x
yq
How It Works
Upgrading from V3
Commands
Evaluate
Evaluate All
Shell Completion
Operators
Add
Alternative (Default value)
Anchor and Alias Operators
Assign (Update)
Boolean Operators
Collect into Array
Column
Comment Operators
Compare Operators
Contains
Create, Collect into Object
Date Time
Delete
Document Index
Encode / Decode
Entries
Env Variable Operators
Equals
Eval
File Operators
Flatten
Group By
Has
Keys
Length
Line
Load
Map
Multiply (Merge)
Parent
Path
Pick
Pipe
Recursive Descent (Glob)
Reduce
Reverse
Select
Sort
Sort Keys
Split into Documents
String Operators
Style
Subtract
Tag
Traverse (Read)
Union
Unique
Variable Operators
With
Usage
Output format
Working with CSV, TSV
Working with JSON
Working with Properties
Working with XML
Front Matter
Split into multiple files
GitHub Action
Tips, Tricks, Troubleshooting
Github Page
Powered By
GitBook
Column
Returns the column of the matching node. Starts from 1, 0 indicates there was no column data.
Note that versions prior to 4.18 require the 'eval/e' command to be specified.
yq e <exp> <file>
Returns column of
value
node
Given a sample.yml file of:
1
a
:
cat
2
b
:
bob
Copied!
then
1
yq
'.b | column'
sample.yml
Copied!
will output
1
4
Copied!
Returns column of
key
node
Pipe through the key operator to get the column of the key
Given a sample.yml file of:
1
a
:
cat
2
b
:
bob
Copied!
then
1
yq
'.b | key | column'
sample.yml
Copied!
will output
1
1
Copied!
First column is 1
Given a sample.yml file of:
1
a
:
cat
Copied!
then
1
yq
'.a | key | column'
sample.yml
Copied!
will output
1
1
Copied!
No column data is 0
Running
1
yq --null-input
'{"a": "new entry"} | column'
Copied!
will output
1
0
Copied!
Previous
Collect into Array
Next
Comment Operators
Last modified
2mo ago
Copy link
Contents
Returns column of value node
Returns column of key node
First column is 1
No column data is 0