Oracle Solaris fixes

Small fixes to enable building on Oracle Solaris 11.2

sed does not allow a space between ! and d
tr requires square brackets around the arguments

Have validated the fixes on MacOS 10.9, and Oracle Solaris 11.2.