Right; the coreutils built in to Darwin are BSD-derived, I was referring to a user installing the GNU versions over top of the OS proper.
sed -i '' 's/foo/bar/g' # BSD sed
sed -i 's/foo/bar/g' # GNU sedThere's far less variance between Perls on different systems than there are for sed/awk/shell. So if you want performant portable code, Perl does better than all of those.
I'd never use Perl for a 'big' program these days but it still beats the crap out of the mess of sed/awk/bash/ksh/zsh.
I don't even have it on my Linux system any more; for better or worse, fewer and fewer things use it.
If you make GNU coreutils the first binaries in PATH, you can expect subtle, _very nasty_ issues.
The last one I encountered was `hostname` taking something like 5 seconds to run. Before that, there was some bug with GNU’s stty which I don’t remember the specifics of.
echo foo | sed -i pattern
echo foo | sed -i .orig
But you can still use "-i.orig"; that should work on both. That will leave you with a .orig file to clean up, but arguably that's not a bad thing as -i can clobber files.