procmail
[Top] [All Lists]

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

2004-12-13 09:08:56
On Mon, 13 Dec 2004, Robert Allerstorfer wrote:

On Sun, 12 Dec 2004, 20:18 GMT+01 Robert Allerstorfer wrote:

This should "clean" a
subject header like (real life example!)

Subject: =?utf-8?q?Today Show - Rolex o?=
 =?utf-8?q?r Cartier or Breitl?=
 =?utf-8?q?ing?=

to

Subject: Today Show - Rolex or Cartier or Breitling

Removing the extra spaces originating from newlines would then give

Subject: Today Show - Rolex o r Cartier or Breitl ing

with still unwanted spaces in it (from the beginning of each new
line). I hope to be able to do this also in pure procmail code.

OK, I think it is not possible to remove leading whitespace from each
line of a multiline string with pure procmail code. Therefore, I will
most likely use sed, like this:

av_SUBJECT = `formail -zx subject | sed -e 's/^[       ]*//'`

(having a SPACE and TAB within the []). A subject like


        Check it carefully!  Some mailers break the line by \n+\t
        the line:  "hello world"  will be break to write:

Subject: hello
         world

   i.e.

Subject: hello
<TAB> world

        In this cases if you remove the TAB and SPACE you will
        get:  "helloworld"

Bye,
 Udi

(BTW. maybe the messages was sent two times, sorry)

____________________________________________________________
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