On Tue, 14 Dec 2004, 00:06 GMT+01 Ruud H.G. van Tol wrote:
Toen wij Robert Allerstorfer kietelden, kwam er dit uit:
The next step is to delete all \n. Can this also done with sed?
http://go.to/sed-faq 3.2
# If a line begins with an equal sign, append it to the previous
# line (and replace the "=" with a single space).
sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D' file
One (portable) way to use that technique is
sed -e :a -e '$!N; s/\n[ ][ ]*/ /; ta' -e 'P;D'
where each [ ] contains a space and a tab.
This will leave any whitespace at the end of a line, replace each
newline
with a single space, and skip all whitespace that is at the start of
a continuation line.
Thanks Ruud for the pointer to the interesting sed techniqes. So, the
solution of removing all newlines from a string with sed is
sed -e :a -e '$!N; s/\n//; ta'
tested and works :-)
# echo -e "First line\nSecond line\nThird line"
First line
Second line
Third line
# echo -e "First line\nSecond line\nThird line" | sed -e :a -e '$!N; s/\n//; ta'
First lineSecond lineThird line
Just a bit strange why this is not included in the sed FAQ.
But see also the examples in section 8 of RFC 2047
http://www.faqs.org/rfcs/rfc2047.html
"White space between adjacent encoded-word's is not displayed."
This is why I now dropped the idea of doing it with sed. See step (4)
of my plan on how to do the whole thing, in my earlier posting
replying to Udi. This is where I currently am :-)
rob.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail