Some sed , especially Mac / BSD, do not interpret \n as a newline, you need to use the actual newline, which is preceded by a backslash:
$ echo foo | sed 's/f/f\n/' fnoo $ echo foo | sed 's/f/f\ > /' f oo $
Or you can use:
echo foo | sed $'s/f/f\\\n/'
Kevin
source share