procmail
[Top] [All Lists]

Re: splitting digests, catching duplicates

1996-12-06 16:25:33
Timothy Luoma responded to a suggestion given him by Alan Stebbens:

|     :0
|     * ^Subject: next-announce
|     { NEWSGROUP=comp.sys.next.software }
|     :0E
|     * ^Subject: next-bugs
|     { NEWSGROUP=comp.sys.next.bugs }
|     :0E
|     * ^Subject: next-hardware
|     { NEWSGROUP=comp.sys.next.hardware }
|     :0E
|     * ^Subject: next-marketplace
|     { NEWSGROUP=comp.sys.next.marketplace }
|     :0E
|     * ^Subject: next-misc
|     { NEWSGROUP=comp.sys.next.misc }
|     :0E
|     * ^Subject: next-software
|     { NEWSGROUP=comp.sys.next.software }
|     :0E
|     * ^Subject: next-sysadmin
|     { NEWSGROUP=comp.sys.next.sysadmin }

Goodness.  Why not just

 :0
 * ^Subject: 
next-\/(announce|bugs|hardware|marketplace|misc|software|sysadmin)
 { NEWSGROUP=comp.sys.next.$MATCH }

Actually, I suggested a table lookup mechanism which is more general,
but if Timothy's subject names are consistently named, then the
optimization you use above will work fine.

The advantage of a table lookup is a more general usage, and it also
allows abbreviation.

  :0
  NEWSGROUP=|awk '$1~/^'`formail -zxSubject:`'/{print $2;exit} newsgroup-table'

this will find the first abbreviation of the subject text in the first
column of newsgroup-table and set NEWSGROUP to the corresponding
element.

The disadvantage is that this requires both an "awk" and "formail"
process. 

On my system, a 150MHz Indy (not an especially fast one, either), I can
afford table lookups; on his MC68020, he might want to use less CPU. :^}

Cheers!
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks