Set (or overwrite) a key to a value in a file (v3)

yq

  • A lightweight and portable command-line YAML processor.
    More information: <https://mikefarah.gitbook.io/yq/>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

yq write --inplace {{path/to/file.yaml}} '{{key}}' '{{value}}'

click the source code to copy install yq on any operating system with command-not-found.com