procmail
[Top] [All Lists]

Re: How to avoid s/\n/ /g when unfolding a header

2004-12-14 17:51:11
Toen wij Robert Allerstorfer kietelden, kwam er dit uit:

the
solution of removing all newlines from a string with sed is

sed -e :a -e '$!N; s/\n//; ta'

tested and works :-)

Why not leave at least a single space where each \n was?

See section 2.2.3. of RFC 2822: "The general rule is
that wherever this standard allows for folding white space (not
simply WSP characters), a CRLF may be inserted before any WSP. 
[...] folding SHOULD be limited to
placing the CRLF at higher-level syntactic breaks.
[...] Unfolding is accomplished by simply removing any CRLF
that is immediately followed by WSP.  Each header field should be
treated in its unfolded form for further syntactic and semantic
evaluation."


Just a bit strange why this is not included in the sed FAQ.

Tsk.

-- 
Grtz, Ruud

____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>