sed append
Mar 29, 2020
To append a line using sed that works on macOS:
sed -e '/^telegraf_enab.*/a\'$'\n''telegraf_user="root"' If need to do it in multiple files, you could use find:
find . -name "rc.conf" -exec sed -i '' -e '/^telegraf_enab.*/a\'$'\n''telegraf_user="root"' {} \; https://stackoverflow.com/a/48406504/1135424
…