building sed for osx

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 ????

-v is for verbose, damnit

So, the vast majority of every day administrative command line utilities for Linux use -v as the switch for verbose…. when you use -v you EXPECT verbose. Well sometimes you get that one package which just CANNOT follow the rules. Someone has to think outside the box, someone has to be a unique snowflake. That someone should not be a mass process killing utility! whoever thought up that the argument -v to pkill should INVERT THE MATCH should really take a long slow look at how important being unique really is… because if you’re not aware of this, and you run something like pkill -9 -v nagios…. as root… it’s not going to do what you expect. Nothing good comes of that command.

This has been a PSA