Tips, Tricks, Troubleshooting
Validating yaml files
yq --exit-status 'tag == "!!map" or tag== "!!seq"' file.txt > /dev/nullSplit expressions over multiple lines to improve readability
yq --inplace '
with(.a.deeply.nested;
. = "newValue" | . style="single" # line comment about styles
) |
#
# Block comment that explains what is happening.
#
with(.b.another.nested;
. = "cool" | . style="folded"
)
' my_file.yamlCreate bash array
yq in a bash loop
Set contents from another file
Special characters in strings
Update multiple files
String blocks and newline issues
Quotes in Windows Powershell
Merge / combine all documents into one
Merge - showing the source file and line
Merge an array of objects by key
Creating a new file / working with blank documents
Comparing yaml files
Reading multiple streams (STDINs)
Updating deeply selected paths
or why is yq only returning the updated yaml
Combining multiple files into one
Multiple updates to the same path
Logic without if/elif/else
yq adds a !!merge tag automatically
Last updated