stream limits? or algorithm help

Cory Petkovsek cory at adaptableit.com
Fri Mar 19 16:51:26 PST 2004


On Fri, Mar 19, 2004 at 03:06:28AM -0800, Stewart Stremler wrote:
> begin  quoting Cory Petkovsek as of Thu, Mar 18, 2004 at 08:30:50PM -0800:
> > What is the limit on streams?
>  
> How many? How much data total? How much data before blocking?
What is the limit on number of streams?


> Given the list of email addresses in 'inputfile'...
> 
> $ sort inputfile | a.script
The problem with this is that sort starts at the first character (ie
username).  I want to sort (or group) by domain, ie everything after @.

After I thought about it a little more a perl hash of arrays is the simplest
way:

m/[a-z0-9\._-]+\@([a-z0-9\._+-]+)/i;
push @{$doms{$1}}, $_;

produces a hash like:
%doms{	test.com	=> ["test at test.com", "jack at test.com", "mike at test.com"]
	happy.com	=> ["jim at happy.com", "mij at happy.com"]

Then I can just cycle through the keys and cycle through the values from
each key.	

> > ( for i in `cat destination_domains` ; do 
> >     ldapdump | egrep $i | sed -e 's/$/ OK/'; echo $i REJECT ; 
> >   done ) > valid_local_senders
> 
> For something done once, that seems fine.  Unless it's been running
> for a week and is 10% of the way done. :)
It will be running every 15 minutes so it needs to be efficient.

Cory

-- 
Cory Petkovsek                                       Adapting Information
Adaptable IT Consulting                                Technology to Your
(858) 705-1655                                                   Business
cory at AdaptableIT.com                                  www.AdaptableIT.com



More information about the KPLUG-List mailing list