I work in linux a lot… not bsd. So the OSX (bsd style) implementation of sed really throws me for a loop when I go text-file-spelunking, whats worse is that my scripts using sed aren’t portable between the two OSs.
A quick googling this morning landed me here: http://wiki.octave.org/wiki.pl?OctaveForMac which gives perfectly good instructions on installing sed. except it didnt work. I grabbed the latest version of sed (4.1.5) and got the error
sed: 1: "install_sh=/Users/apoka ...": command i expects \ followed by text sed: 1: "install_sh=/Users/apoka ...": command i expects \ followed by text
Ironic, huh? Well taking a guess that at some point sed hadcome to depend on its own functionality to configure itself I jumped back a version… Figuring i replace BSD sed with an out of date GNU sed, and then use the old GNU sed to build the new GNU sed. Which worked great. I Installed first sed-3.0.2, and then 4.1.5 in this manner:
./configure --prefix=/usr/ --with-included-regex --with-included-gettext && make && sudo make install
I’m happy with my -r again…
# date | sed -r s/'[0-9]'/'?'/g Thu Apr ?? ??:??:?? PDT ????