procmail
[Top] [All Lists]

RE: how to strip down a subject line

2008-11-20 14:54:03
"TLD Procmail" wrote Thursday, November 20, 2008 8:25 PM:

:0
* ^Subject:\/.*
{ SUBJECT = $MATCH }

Now, what I want to do is make a copy of this, but strip
out everything but letters and spaces.  So, I wrote a
simple perl script (since I have no clue if this can be
done in procmail):

I suggest you take a refersher in some basic Unix shell
command and their possibilities.  You certainly do not need
to write anything in perl to do this.  Just use /usr/bin/tr.


Then, I tried to assign the output of this script into SUBJECT2.
It doesn't want to work, the SUBJECT2 is always blank.  I think
maybe it's passing out a blank.  Here is what I put into my
/etc/procmailrc:

STRIPCMD="/usr/local/bin/subject.stripper.pl '${SUBJECT}'"
LOG="STRIPCMD(${STRIPCMD})"
SUBJECT2=`$STRIPCMD`
LOG="SUBJECT2(${SUBJECT2})"

Now, STRIPCMD looks great and the log file shows it correctly.
However, SUBJECT2 is always blank.

Is something obviously wrong?

I don't know about "obviously," but: is your script chmodded right?
Etc.  I again say, though: you don't need any such thing as this.
Just do:

  SUBJECT2 = `echo "$SUBJECT" | tr -dc 'a-zA-Z  '`  # space and tab are in 
there too

-- 
dman
  

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