IT notes

sed append

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"' {} \;

Find and replace recursive

Note: Do not run this command on a folder including a git repo - changes to .git could corrupt your get index. For example to replace an IP on multiple files: find /tmp/path -type f -exec sed -i '' 's/' {} + On BSD, MAC by passing an empty string to sed’s -i args will create no backup perl -pi -e perl -pi -e 's/replace_this/with_this/" This is useful when you don’t want to change the file ending like in sed that adds an \n ad the end of the file