procmail
[Top] [All Lists]

Re: Procmail-recipe problem!

1998-02-24 12:54:44
I wrote,

| > So we have these choices:
| > (a)
| >    :0hfi
| >    | true
| >
| >    :0fhw # `h' now refers to second set of headers
| >    | formail
| >
| > or (b)
| >    :0fw
| >    | sed '1,/^$/d;/./,$ !d' | formail
 
Era responded,

| Well, what about leaving it in if it was there in the first place?
| 
|     :0fh
|     | grep '^From[    ]'

All that will do is remove lines from whatever is the current header unless
they begin "From ".

We can keep a From_ that is already there ... though I doubt that it would
be, since it arrived as part of the body, and thus it would be escaped unless
it had been protected by Content-Length:.  But I think it's better for
formail to generate a new one with the current timestamp.  Anyhow, if we
must keep an existing one,

   :0hfi
   | true

   :0fhw # `h' now refers to second set of headers
   * ^^>From ()
   | sed 1s/.//
   :0Efhw
   * ! ^^From ()
   | formail

but in all honesty, even if there is a From_ line with valid syntax at the
top of the body, I'd rather let formail generate a fresh one:

   :0Bf
   * ^^($)*([^   ]+:|From[      ])
   | sed '1,/^$/d;/./,$ !d' | formail -I 'From ' -a 'From '
   :0EBf # don't let sed be fooled by a >From in the original head
   * ^^($)*>From[       ].*$[^  ]+:
   | sed -ne 'N;/\n>From[       ]/!D;:a' -e 'n;p;ba' | formail -a 'From '
 # | sed '1,2d;3,/^>From[       ]/d' | formail -a 'From '

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