Hi, This is the perl script that I had written... ----------------------------------------------------------- #!/usr/bin/perl -w
@a = <>; @b = sort @a; for($i=0;$i<@a;$i=$i+1){ print "$b[$i]"; } ------------------------------------------------------------- But this runs out of memory. I that there is not enough memory to hold 36 million lines with 52 characters in each line. So I am doing it the following way (Completely Unix). sort -u -T /filesystem file.dat > file_out.dat where file.dat is my input file and file_out.dat is my output file. The version of Perl is 5.8. I am going to try DB_FILE module once. Hope this helps.... Thanks and Regards, Vishal On Mon, 14 Feb 2005 10:34:30 -0500, Jay <[EMAIL PROTECTED]> wrote: > On Mon, 14 Feb 2005 20:25:18 +0530, Vishal Vasan <[EMAIL PROTECTED]> wrote: > > Sorry about that. The file has 36,000,000 records. > > > > Regards, > > --V > > > > > > On Mon, 14 Feb 2005 20:24:15 +0530, Vishal Vasan <[EMAIL PROTECTED]> wrote: > > > Hello All, > > > > > > I am trying to sort a file with records. I have tried to slurp all the > > > records present in the file to memory but the memory has run out. > > > > > > Now I am doing it in shell script itself and it takes around 2 hours > > > for the file. I have around 10 files more to go. Could somebody help > > > me as to how to sort the file in some efficient way to sort the file? > > > I am trying to implement mergesort and found that by default perl v5.8 > > > uses merge sort hoping that it would be faster. > > > > > > Regards, > > > Vishal. > > > > > Vishal, > > the only way we could help you do something different is to know what > you're doing now. We could discuss algorithms all day, but that > wouldn't help the implementation. Let us see the code you've written, > an someon will probably have a suggestion. > > best, > > --jay > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>