in reply to Not case sensitive hash?

Update: The below code has two bugs in it. Don't use it. Twas a joke.

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
    Why all the effort? perl -e'@uniq{map lc, <>}=(); print keys %uniq' listfile

    Makeshifts last the longest.

      My is very much faster on large inputs than yours. They are very different.

      Hint, wink, wink, wink. I don't think anyone got the joke. I'll know better next time.

        Oh, right. An array will take less memory and is faster, true.

        Makeshifts last the longest.