Re: [EXIM] How to remove string in subject?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Frederick Page
Dátum:  
Címzett: exim-users
Tárgy: Re: [EXIM] How to remove string in subject?
Hi Ben Smithurst,

you wrote on Sat, Feb 27, 1999 at 01:03:17AM +0000:

>> if
>>    $header_Subject: matches "\\[Debian\\]: "


>Oh, that works?


Yes, I ran "exim -bf .forward < test.msg" and the testprint worked.
But there is no need to involve regular expressions, so I changed the
condition (see below).

My theory is: pipe the message to a stream-editor which is capable of
Perl regular expressions and simply substitute the string "[Debian]: "
with nothing. The substitution only takes place, if the regexp is
true.

if
$header_Subject: contains "[Debian]: "
then
testprint "subject=$header_Subject:"
pipe "sed -e 's/\[Debian\]: //'"
endif
    
When running "sed -e 's/\[Debian\]: //' < test.msg | less" I get the
desired result. "exim -bf .forward < test.msg", also indicates, that
the conditions are met, no errors, but I haven't polled for email yet.

This might be crude, since all occurences of "[Debian]: " are
substituted, even if they are not in the header of the mail. So my
next goals are:

1. limit the regexp to the Subject: line only
2. remove superfluous "Re:" (like Re: [Debian]: Re: virus warning)
3. substitute two or more whitespaces by one whitespace

All three goals limited to the Subject: line, of course.

I will keep you informed.

>As for the replacement, I don't think you can with Exim.


Right, that's what pipes are for :-) pipe the mail e.g. to a
stream-editor which can do that (man sed).

>You'll probably have to use a Perl script or something.
>That's what I started, then decided it wasn't worth it.


I guess you can do it with Perl, but since substitution can be done
via regexps, why bother with Perl? Let sed bother with it :-)

>(Though I don't see the point of these
>subject prefixes, it just wastes seven characters of the subject column
>in my mailer's mailbox index list.)


I also hate those subject manglings, because they also mess up the
"Re:", there are people who remove the [Exim], others don't, everybody
prefixes the subject with "Re:" :-(

The list-maintainers claim it to be an aid for newbies, so they can
visually filter (because they don't know how to filter with e.g.
Exim). We had pros and cons on other mailing-lists and nothing
changed. :-(

Especially as maintainer of the Exim-List, I would *not* put in [Exim]
so the newbies would have more motivation in setting up their .forward
:-)

I hope, this info is not useless, maybe old stuff for the advanced
users, but I'm a newbie (5 weeks Linux now) and this might help other
people too.

Kind regards

Frederick

--
registered linux user # 107970 (http://counter.li.org)


--
*** Exim information can be found at http://www.exim.org/ ***