OS X compatibility: BSD sed can't handle \n newlines in sed patterns

Used a solution described at:

http://stackoverflow.com/questions/723157/how-to-insert-a-newline-in-front-of-a-pattern