[clug] Thursday afternoon Perl/bash golf time

Andrew Janke a.janke at gmail.com
Thu Jun 11 00:42:58 MDT 2015


> cat failed? shell didn't pass the large number of args? Perl failed?

Sorry, yes shell failed from too many arguments.

> What values of "a large number" ?

10,000+  I should also add that the final size of the output file will
easily exceed 5GB and at times come close to 1TB...  So in memory
isn't going to cut it!

> 2) looks good enough on prejudice fwiw.

Yup, just gets ugly calling that from within perl, pity File::Copy
doesn't do append.  I'm testing this for speed right now...

open(OFH, "$opt{'tmpdir'}/all.raw");
binmode(OFH);
for($i=0; $i<=$#catfiles; $i++){

   my($buf);

   $buf = "";
   open(IFH, "<", $catfiles[$i]);
   binmode(IFH);

   while( read(IFH, $buf, 65536) != 0){
      print OFH $buf;
      }

   close(IFH);
   }

close(OFH);

ta



a


More information about the linux mailing list