ContextQMD
Libraries
Rankings
Queue
About
Log in
Get started
Open menu
Back to Libraries
Yq
yq
GitHub
yq
mikefarah/yq
mikefarahyq
mikefarah
Homepage
3 versions
154 pages (4.53.2)
4 aliases
3
Versions
154
Pages (4.53.2)
4
Aliases
Pages
Versions
Usage
4.53.2
▼
stable
General rules
Architecture
Key Files
Interfaces
Step-by-Step: Adding a New Encoder/Decoder
+30 more
github.com/mikefarah/yq/blob/v4.53.2/agents.md
16.1 KB
Full page
Expression Syntax: A Visual Guide
Step 2: Splatting the Array
Step 3: Filtering the Nodes
Step 4: Extracting a Field
Simple assignment example
+2 more
github.com/mikefarah/yq/blob/v4.53.2/how-it-wor...
5.2 KB
Full page
Add
Concatenate to existing array
Concatenate null to array
Append to existing array
Prepend to existing array
+12 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
4.4 KB
Full page
Alternative (Default value)
LHS is not defined
LHS is null
LHS is false
RHS is an expression
+2 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.3 KB
Full page
Anchor and Alias Operators
Merge one map
Get anchor
Set anchor
Set anchor relatively using assign-update
+15 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
7.4 KB
Full page
Array to Map
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
456 B
Full page
Assign (Update)
relative form: `|=`
Flags
Create yaml file
Update node to be the child value
+13 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
3.6 KB
Full page
Boolean Operators
`or` example
"yes" and "no" are strings
`and` example
Matching nodes with select, equals and or
+13 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
3.7 KB
Full page
Collect into Array
Collect single
Collect many
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
424 B
Full page
Column
Returns column of _key_ node
First column is 1
No column data is 0
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
831 B
Full page
Comment Operators
relative form: `|=`
Set line comment
Set line comment of a maps/arrays
Use update assign to perform relative updates
+13 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
5.5 KB
Full page
Compare Operators
Compare numbers (>)
Compare equal numbers (>=)
Compare strings
Compare date times
+2 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.5 KB
Full page
Contains
Array has a subset array
Object included in array
Object not included in array
String contains substring
+1 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.8 KB
Full page
Create, Collect into Object
Wrap (prefix) existing object
Using splat to create multiple objects
Working with multiple documents
Creating yaml from scratch
+1 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.2 KB
Full page
Date Time
Timezones
Durations
Format: from standard RFC3339 format
Format: from custom date time
+11 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
4.6 KB
Full page
Delete
Delete nested entry in map
Delete entry in array
Delete nested entry in array
Delete no matches
+2 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.3 KB
Full page
Divide
Number division
Number division by zero
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
759 B
Full page
Document Index
Retrieve a document index, shorthand
Filter by document index
Filter by document index shorthand
Print Document Index with matches
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.0 KB
Full page
Encoder / Decoder
Encode value as json string, on one line
Encode value as json string, on one line shorthand
Decode a json encoded string
Encode value as props string
+22 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
7.7 KB
Full page
Entries
to_entries Array
to_entries null
from_entries map
from_entries with numeric key indices
+4 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
2.3 KB
Full page
Env Variable Operators
Tip
Disabling env operators
Read string environment variable
Read boolean environment variable
+20 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
6.2 KB
Full page
Equals / Not Equals
Match string
Don't match string
Match number
Don't match number
+3 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.7 KB
Full page
Error
Validate the environment variable is a number - invalid
Validate the environment variable is a number - valid
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1018 B
Full page
Eval
Dynamically update a path from an environment variable
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
949 B
Full page
File Operators
Get filename
Get file index
Get file indices of multiple documents
Get file index alias
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
1.2 KB
Full page
Filter
Filter map values
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
489 B
Full page
First
First matching element from array with multiple matches
First matching element from array with numeric condition
First matching element from array with boolean condition
First matching element from array with null values
+14 more
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
3.9 KB
Full page
Flatten
Flatten with depth of one
Flatten empty array
Flatten array of objects
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
710 B
Full page
Group By
Group by field, with nulls
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
657 B
Full page
Has
Select, checking for existence of deep paths
Has array index
github.com/mikefarah/yq/blob/v4.53.2/pkg/yqlib/...
775 B
Full page
1–30 of 154
1
2
3
4
5
6
Page 1