[Cialug] damn spammers

Daniel A. Ramaley daniel.ramaley at DRAKE.EDU
Wed Nov 7 14:06:40 CST 2007


On Wednesday 07 November 2007 09:58, Dave Weis wrote:
>Out of 2.5 million encounters with our mail server, there are 225,000
>unique IP addresses based on some processing with cut, sort, and uniq.
>I'm sure it would have been one line of perl but I didn't want to wear
>out my punctuation keys. :-)

As someone who writes a little Perl nearly every day, i agree that cut, 
sort, and uniq are probably the right tool for the job:

cat inputfile | cut $ARGS | sort | uniq

cat inputfile | perl -ne '$hash{$1} = 0 if m/$REGEX/; END { print "$_\n" foreach sort keys %hash; }'

Of course, $ARGS and $REGEX would have to be set appropriately for 
either of these samples to work. Someone else may have a more efficient
way to do the Perl version...

------------------------------------------------------------------------
Dan Ramaley                            Dial Center 118, Drake University
Network Programmer/Analyst             2407 Carpenter Ave
+1 515 271-4540                        Des Moines IA 50311 USA


More information about the Cialug mailing list