| When combining two lines as one in sed's regexp/condition, is it
| possible to combine the lines with a return in between?
If you're trying to get two lines of text into the pattern space at once,
the command in sed is N.
If you're trying to put an embedded newline into a search pattern, use \n,
but it will match only if the pattern space has an embedded newline in it
(after an N or G command, for example). /line1\nline2/ won't match unless
both line1, an embedded newline between them, and line2 are in the pattern
space at the same time; if you just let sed do its usual thing of processing
lines of input one at a time, there will never be an embedded newline in the
If you're trying to embed a newline into a replacement pattern, it has to
be entered literally and escaped with a backslash, as others have said. In
sh and sh-derivatives, that's possible at a shell prompt (though it must be
quoted); in csh and its derivatives, it is impossible at a shell prompt [as
I understand] because it will not be preserved, even within quotes, to be
passed to the command. Depending on what exactly you want to accomplish,
you might be better off using the a\ or i\ commands rather than an s command,
but csh and csh-based shells will still give you the same problem.
procmail mailing list