OS X currently comes with a FreeBSD sed from 2005. Most of the differences below also apply to other BSD sed versions.
OS X’s sed uses
-E for ERE and GNU sed uses
-E is an alias for
-r in GNU sed (added in 4.2, not documented until 4.3). Newer versions of FreeBSD and NetBSD sed support both
-r. OpenBSD sed only supports
-i '' works with OS X’s sed but not GNU sed.
-i works with GNU sed, recent versions of NetBSD, OpenBSD
sed, but not OS X’s sed.
-i -e works with both but in the case of FreeBSD
sed makes a backup of the original file with
-e appended to the file name (and you need to pass no more than one expression to
GNU sed interprets escape sequences like