sort file

2002-02-13 Thread Susan Aurand

What is the fastest or best way to sort a file alphabetically, the
rewrite it to a file.

Thanks
Susan
Haywood County Schools


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: sort file

2002-02-13 Thread Jon Molin

Susan Aurand wrote:
> 
> What is the fastest or best way to sort a file alphabetically, the
> rewrite it to a file.
> 

you'll print this very fast anyway :)

sort file > temp_file;mv temp_file file

/Jon


> Thanks
> Susan
> Haywood County Schools
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Problem when sort file

2004-05-09 Thread John Doe
Hello all,
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 ?

Regards,
John



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problem when sort file

2004-05-13 Thread John Doe
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]
 



Re: Problem when sort file

2004-05-13 Thread John Doe
John McKown wrote:
On Sun, 9 May 2004, John Doe wrote:


Hello all,
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 ?

Regards,
John


John,
What system? If you are on UNIX, I'd use the external "sort" command to 
sort my data, then use the "uniq" command. Much easier than using Perl, in 
my opinion.

sort output.file

I can't help you if you are running under Windows. I don't think it has a 
"sort" or "uniq" command. If you need to process the records in Perl, I 
would most likely do:

sort 

--
Maranatha!
John McKown
Thanks,
this method is work great.
Regards,
John
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Problem when sort file

2004-05-09 Thread John W. Krahn
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
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problem when sort file

2004-05-09 Thread John McKown
On Sun, 9 May 2004, John Doe wrote:

> Hello all,
> 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 ?
> 
> Regards,
> John
> 

John,
What system? If you are on UNIX, I'd use the external "sort" command to 
sort my data, then use the "uniq" command. Much easier than using Perl, in 
my opinion.

sort output.file

I can't help you if you are running under Windows. I don't think it has a 
"sort" or "uniq" command. If you need to process the records in Perl, I 
would most likely do:

sort http://learn.perl.org/>