in reply to Not case sensitive hash?
If I were tempted to deal with a mailing list like you describe I'd use this program to clean it up real quick. Then I could go on to other things.
This is faster than the other suggestions you've gotten so far, well for almost every input file. It's especially efficient on larger files, note the not very subtle tricks used to increase speed. Certainly you don't have to go to shell to handle this.
This is probably not quite as good as what Chip might come up with though.
#!/usr/bin/perl -w use strict; my $file = "rawlistfile"; my @eadds; open INPUT, "+>$file" or die "Can't open $file for reading!"; my @eadds = <INPUT>; foreach ( @eadds) { $_ = lc } my $prev; @eadds = sort @eadds; my $cur = $eadds[0]; my $i = 0; while ( $cur le $eadds[-1] ) { print "$prev\n" if $prev ne $cur and $prev; $prev = $curr; $curr = $eadds[++$i]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Eliminating addresses in bulk
by Aristotle (Chancellor) on Oct 25, 2002 at 22:40 UTC | |
by rir (Vicar) on Oct 26, 2002 at 06:02 UTC | |
by Aristotle (Chancellor) on Oct 26, 2002 at 12:26 UTC | |
by valdez (Monsignor) on Oct 26, 2002 at 14:11 UTC | |
by rir (Vicar) on Oct 26, 2002 at 18:15 UTC |