Linux/Ubuntu edit YAML/YML with yq / Shell Terminal Netplan

https://github.com/kislyuk/yq

Uses "jq": https://stedolan.github.io/jq/tutorial/

Installation

  • apt install python-pip
  • pip install yq

Usage

  • cat /etc/netplan/01-netcfg.yaml | yq --yaml-output '.network.ethernets.enp3s0.nameservers.search = ["example.com"]' > /tmp/foo; mv /tmp/foo /etc/netplan/01-netcfg.yaml