procmail
[Top] [All Lists]

Re: sed-oneliner to unfold a single header

2004-04-07 04:05:23
On Wed, Apr 07, 2004 at 12:02:02PM +0200, Ruud H.G. van Tol wrote:
Because procmail already unfolds header-lines, you are not likely 
to need this:

    sed -e '/^$/q; /^Header-Name/!d; :a'\
        -e 'N; s/\n[[:blank:]]\{1,\}/ /; ta'\
        -e 's/\n.*//;q'

The /^Header-Name/ can be made stronger, like /^Header-Name[[:blank:]]*:/

sed is case-sensitive, so you might need to do 
/^[Cc][Oo][Nn][Tt][Ee][Nn][Tt]-[Tt][Yy][Pp][Ee][[:blank:]]*:/

This sed-oneliner was recently created by Laurent Vogel (and me) 
on the [sed-users] mailinglist. It takes the first occurence of 
a specified header-line and unfolds it. 

First off, I'd use "formail -c", which unfolds the lines.  Second,
if I wanted to use sed, I'd use gsed, which has an /I option for
case-insensitivity.

Interesting, though.

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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