procmail
[Top] [All Lists]

Resend: Fixing up broken headers how?

2002-01-03 12:59:49
[This is the second of the five.]

Gary Funck wrote,

| :0 fbhw
| * ^From:(_dot_)*(_at_)news(_dot_)palmos(_dot_)com
| | sed -e '1,/^$/d' | sed -e '1,/^From: / {/^From: / \!d \
|   }' | formail

| 1. The first sed command strips off the initial header

Better yet, just use the `b' flag without `h' (`hb' is the default anyway,
though the man page describes that poorly), and you won't need to tell sed
to strip the first head.

 :0bfw
 * ^From:(_dot_)*(_at_)news\(_dot_)palmos\(_dot_)com
 | sed '/^From:/,$ \!d' | formail # don't rely on a space after the colon

where the backslash is needed only if $SHELL is csh or a derivative but is
harmless for other shells.

| 2. The second sed command strips off everything in the body up to (but not
| including) the first "From: " line. Note - these two sed commands cannot
| easily be combined into one.

Actually, they can be -- though if you use the `b' flag on the recipe, they
don't need to be; but if you had to feed the whole message to the command
line,

 | sed -e '1,/^$/d' -e '/^From:/,$ \!d' | formail

with the same comment about the backslash.  (Since any From: line in the
first head is deleted by the first instruction, it doesn't trigger the start
of the range for the second instruction.)




_______________________________________________
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>
  • Resend: Fixing up broken headers how?, David W. Tamkin <=