Options (2)
-C, --colorsbooleanOutput a YAML file, in pretty-print format (v3)
Example:
yq read {{path/to/file.yaml}} {{[-C|--colors]}}-i, --inplacebooleanSet (or overwrite) a key to a value in a file (v4+)
Example:
yq eval '.{{key}} = "{{value}}"' {{[-i|--inplace]}} {{path/to/file.yaml}}Examples (8)
Output the first element in a YAML file that contains only an array (v4+)
Output the first element in a YAML file that contains only an array (v3)
Set (or overwrite) a key to a value in a file (v4+)
Set (or overwrite) a key to a value in a file (v3)
Merge two files and print to `stdout` (v4+)
yq eval-all 'select(filename == "path/to/file1.yaml") * select(filename == "path/to/file2.yaml")' path/to/file1.yaml path/to/file2.yamlMerge two files and print to `stdout` (v3)
yq merge path/to/file1.yaml path/to/file2.yaml [-C|--colors]made by @shridhargupta | data from tldr-pages