'sed' command updated to be strictly POSIX compliant

http://stackoverflow.com/questions/11938306/sed-on-mac-os-x