procmail
[Top] [All Lists]

Re: Why does this rule work?

1999-06-10 02:48:27
Randall Hopper mentioned a recipe to remove list tags from 
subject lines:

  :0
  * ^Subject:[ ]+\/.*
  {
    subj = `echo "$MATCH" | sed -e 's/\[opendx-general\] //g'`

    :0 fwh
    | formail -I "Subject: $subj"
  }

Do you really need all that? I'd just use

        :0 fwh
        | sed '/^Subject:/s/\[opendx-general] //'

instead. Minor caveats: This is less efficient if there's no
subject header - I don't know whether that's possible at all in
the messages you finally receive or whether the list software
automatically adds it when it's missing, but if you're worried
about that, just add a condition to check. There are also cases
when the results are different (if you get messages with
"SUBJECT" or so instead of "Subject", or if the subject line is
wrapped before the list tag), but in my experience these only
exist in theory; I'm on several lists where I use recipes of that
kind, and I haven't ever encountered one of those problems. Of
course, YMMV. (Also for the final "g", by the way; I haven't
found it necessary so far, but maybe you get subject lines with
several tags?) 

/HW

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