Using sed on FreeBSD

Unix

06 Dec 2015

Using sed on FreeBSD

Preston Garrison 0 Comments

Every time I go to use sed on FreeBSD I have to google to remember how to use it.  The problem is that sed requires you to pass a extension for the backup file on an in place edit.  The easiest way is just to pass a null string, so it doesn’t create a backup file like so:

 

sed -i '' -e's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin@' /etc/rc