procmail
[Top] [All Lists]

Re: problem geting partial string

2010-06-11 16:33:13
Michelle Konzack wrote:

I have a From: line in a E-Mail where I need to get

1)  anything after the last ":".
2)  anything before the last ":"

$ echo "From: test1" | split.rc

$ echo "From: test1:" | split.rc
after=''
before='From: test1'

$ echo "From: test1: test2: test3" | split.rc
after=' test3'
before='From: test1: test2'



split.rc:

#!/usr/local/bin/procmail

NL="
"

:0
* ^From:.*:\/[^:]*$
* MATCH ?? ^\/.*
{ LOG=after=\'$MATCH\'$NL }

:0
* ^\/From:.*:
* MATCH ?? ^\/.*[^:]
{ LOG=before=\'$MATCH\'$NL }



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