The sed documentation says that in order to insert newlines in
substitute commands, you should quote them with backslashes.
[Surround the commands with single quotes (
'), as Chris has.
If you use double quotes (
"), this script will become
s/foo/bar/ because of
sed -e 's/foo/b\ a\ r/'
Indeed, this works quite well in the Bourne shell, which does what I considerwith this input. The C shell, however, , and , and instead you must type:
sed -e 's/foo/b\\ a\\ r/'
Probably the best solution is to place your sed commands, to keep the shell's sticky fingers off them.
- in net.unix on Usenet, 20 November 1985