in reply to 'sort -u' in perl
Install Sort::External from CPAN. It was written for the purpose of sorting huge files.
my $sortex = Sort::External->new(); while (<HUGEFILE>) { $sortex->feed($_); } $sortex->finish; my $prev = ''; while ( defined( $_ = $sortex->fetch ) ) { next if $_ eq $prev; print OUTFILE $_; $prev = $_; }
|
|---|