sed
does not support the escape sequence \n
in its wildcard command, however it does support the real newline if you avoid it (since sed
should use only one line, and escape here to tell sed
that you really want a newline ):
$ sed 's/),(/),\\ (/g' temp.txt (foo), (bar) (foobar), (foofoobar)
You can also use a shell variable to store a newline character.
$ NL=' ' $ sed "s/),(/,\\$NL(/g" temp.txt (foo), (bar) (foobar), (foofoobar)
Tested on Mac OS X Lion using bash
as a shell.
source share