John W. Krahn wrote:
John Doe wrote:
Hello all,
Hello,
i trying to sort one my file that is 10 MB and contain
records:
---
aa
adsad
dasd
das
aa
---
i want to sort and eleminate double records.
I use:
$perl -0777ane '$, = "\n"; @[EMAIL PROTECTED] = (); print sort keys %uniq' \ out.log
But i recive error: Out of memory!
Yeah, this is normal, the file is 10 MB.
Any body can help me ?
You are reading the whole file into @F. Try doing it by reading one
record at a time.
perl -lne'$uniq{$_}++; END{print for sort keys %uniq}' out.log
John
This is work for files that is not so big < 10 MB.
But thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>