Is there an invocation of sed
todo in-place editing without backups that works both on Linux and Mac? While the BSD sed
shipped with OS X seems to
The following works for me on Linux and OS X:
sed -i' '
e.g. for a file f
containing aaabbaaba
sed -i' ' 's/b/c/g' f
yields aaaccaaca
on both Linux and Mac. Note there is a quoted string containing a space, with no space between the -i
and the string. Single or double quotes both work.
On Linux I am using bash
version 4.3.11 under Ubuntu 14.04.4 and on the Mac version 3.2.57 under OS X 10.11.4 El Capitan (Darwin 15.4.0).