[Mailman-Users] shell script to make consolidated list from other lists?

Jon Carnes jonc at nc.rr.com
Fri Dec 5 23:35:05 CET 2003


On Fri, 2003-12-05 at 15:22, John Dell wrote:
> On Friday 05 December 2003 01:01 am, Simon White wrote:
> > 04-Dec-03 at 15:43, Dennis Black (dennis.black at ualberta.ca) wrote :
> > Hmmm
> >
> > uniq -u means print only unique lines. uniq -d means only duplicate
> > lines. uniq only works well if sort is applied first. add_members /
> > sync_members will ignore dupes anyway (but sort then uniq might be
> > quicker). tr is not obligatory but I can see what you're getting at
> > (changing case so that everyone's emails are in lower case for both
> > lists).
> 
> Yep, I noticed this problem also in testing.
> 
> > I'd do something a bit more like (replace $prefix with path to mailman)
> >
> > # get member lists into the temp file
> > $prefix/bin/list_members the-a-list > /tmp/abc.wk1
> > $prefix/bin/list_members the-b-list >> /tmp/abc.wk1
> >
> > # convert everything to lower case
> > tr '[A-Z]' '[a-z]' < /tmp/abc.wk1 > /tmp/abc.wk2
> 
> I noticed in mm 2.1.x that list_members returns all lowercase unless you 
> provide a flag to return original case as entered, so this isn't necessary.
> 
> > # deduplicate from 2nd temp file and overwrite 1st temp file, to save
> > # counting upwards all the time; we could do this on one line and pipe
> > # to another pipe and so on... but separating isn't such a bad thing
> > sort -d /tmp/abc.wk2 | uniq > /tmp/abc.wk1
> >
> > # now sync back to the list
> > $prefix/bin/sync_members -w=no -f /tmp/abc.wk1 the-big-list
> 
> I now have a working script!  So thanks again to all for your ideas and 
> feedback!
> 
> Regards,
> John

Coming late to this party, but have you guys looked at FAQ 3.5
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq03.005.htp

It has a similar script that's worked for a few years now...

Jon Carnes





More information about the Mailman-Users mailing list