procmail
[Top] [All Lists]

Re: Removing line-wrapped header

2004-09-09 17:51:57
Toen wij Dallman Ross kietelden, kwam er dit uit:

One could also run the message through sed *first* and mark all line
breaks with something known, such as a tilde.  Then look for that in
the re-split at the end.  But now we've got two sed calls and an echo,
so that's no better than one perl or awk, I suppose.

As I wrote before, just one sed-call can do it.

Put this in remove.sed:

/^Bad-header:/!b
:loop
$bend
N
/\n[^[:blank:]]/!bloop
h
s/^\(.*\)\n.*$/\1/;
/bad-string/{
   g; s/^\(.*\)\(\n.*\)$/\2/; D;
}
p; g; s/^\(.*\)\(\n.*\)$/\2/; D;
:end
/bad-string/b
d


Put this in your rc:

  :0 h fw
  * ^Bad-header:.*bad-string
  | sed -f remove.sed

-- 
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>