bergman on 20 Jan 2006 16:08:08 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] procmail and matching on split lines



In the message dated: Fri, 20 Jan 2006 08:31:58 EST,
The pithy ruminations from Jeff Abrahamson on 
<[PLUG] procmail and matching on split lines> were:
=> 

=> 
=> I have a procmail rule that guarantees I don't miss mailman notices
=> that I have to approve:
=> 
=>     :0:
=>     * ^Subject: .*post.*requires approval
=>     /var/mail/$LOGNAME
=> 
=> It turns out that a very long email address can foil this:
=> 
=>     Date: Fri, 20 Jan 2006 00:12:19 -0500
=>     From: cs260-200502-owner@cs.drexel.edu
=>     Subject: Cs260-200502 post from xxxxx.yyyyy.zzzzzzzz@drexel.edu requires
=> 	    approval
=>     To: cs260-200502-owner@cs.drexel.edu
=> 
=> I didn't realize subject lines could contain hard breaks.  I'm not

I believe that the "broken" line (with the initial whitespace) was inserted
by the MUA, not the user. In mail-speak, it's a continued line, and is treated 
as part of the precceding line...except that line-oriented utilities like 
procmail don't know that.

=> sure how to match this without matching anything containing "post" and
=> "requires".  Indeed, an even longer email address could push
=> "requires" to the next line, and I'm not clear how to match that.
=> 
=> I think this would work, but feels overly broad:
=> 
=>     :0:
=>     * ^Subject: .*post
=>     * ^.*requires
=>     * ^.*approval$
=>     /var/mail/$LOGNAME
=> 
=> Any suggestions for doing better?
=> 

There's a tool that's specific to this job...formail. Check out the "-c" 
(concatenate) option.

----
Mark Bergman
bergman@merctech.com
Seeking a Unix/Linux sysadmin position local to Philadelphia or via telecommuting

http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=bergman%40merctech.com


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug