Fixes for FreeBSD/MacOSX BSD-style sed