Great Circle Associates Majordomo-Users
(June 2001)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: Sorting addresses by domain
From: wings @ wingscc . com (Jardine Parrot Web)
Date: Thu, 21 Jun 2001 17:33:11 -0500
To: Majordomo-users @ GreatCircle . COM

Below is a snip of my responce on the issue from the Message duplication
problem thread.

I don't know which of the two scripts is the faster one.
I would be interested in finding out how the scripts compare for small,
medium, and large subscriber files on the time each take to be sorted.

<snip>
The only argument is the listname subscriber file.

#!/usr/bin/perl
$list = $ARGV[0];
system("mv $list $list.bak ; cat $list.bak | tr A-Z a-z | sort -t@ -k2 >
       $list ; chmod 660 $list ; chown majordomo:majordomo $list\n");
exit(0);

Note the 4th line is a continuation of the system command on the 3rd line.
</snip>

At 09:36 AM 6/21/01 -0500, you wrote:
>The recent discussions on how to improve majordomo/sendmail performance by
>sorting the list files by domain prompted me to try to do this for my own
>lists. Finding no script to do this already written, I put together the
>following perl script to do the sorting. The directory the list files are in
>is defined in the chdir function in the script. The script assumes the list
>files are the only files in the directory _without_ a period in the name.
>
>#! /usr/bin/perl
>
>chdir "/var/lib/majordomo/lists/testdir";
>@listnames = `ls`;
>@lists = grep (!/\./, @listnames);
>unlink 'lists.out';
>
>for my $list (@lists)
>   {
>      chomp $list;
>      open LISTFILE, $list;
>      print $list."\n";
>      @fileaddresses = ();
>
>      while (<LISTFILE>)
>      {
>         chomp;
>         ($account, $host) = split (/\@/,  $_); 
>         push @fileaddresses, lc($host)."@".lc($account)."\n";
>      }
>
>      @sortedaddresses = sort @fileaddresses;
>      open OUTFILE, ">>sortedlist.out";
>
>      for my $sortedaddress (@sortedaddresses)
>      {
>         chomp $sortedaddress;
>         ($sortedhost, $sorteddest) = split (/\@/, $sortedaddress);
>         print OUTFILE $sorteddest."@".$sortedhost."\n";
>      }
>      close OUTFILE;
>
>      `mv sortedlist.out $list`;
>      unlink "sortedlist.out"; 
>   }
>
>All comments/suggested improvements are welcome.
>
>Bill Anderson
>MIS Network Administrator
>MO Dept of Economic Development
>
>
>



Follow-Ups:
Indexed By Date Previous: Re: Sorting addresses by domain
From: hunter <hunter@userfriendly.net>
Next: Re: Sorting addresses by domain
From: "Joe R. Jah" <jjah@cloud.ccsf.cc.ca.us>
Indexed By Thread Previous: Re: Sorting addresses by domain
From: hunter <hunter@userfriendly.net>
Next: Re: Sorting addresses by domain
From: "Joe R. Jah" <jjah@cloud.ccsf.cc.ca.us>

Google
 
Search Internet Search www.greatcircle.com