[clug] Thursday afternoon Perl/bash golf time
Hal Ashburner
hal at ashburner.info
Thu Jun 11 01:43:05 MDT 2015
Random stupid ideas R us and it's been a few years since I've perl'd, miss it.
Open cat with no args redirected to where you want the output as a
pipe in perl then just throw the contents of each file at it with
print ?
On 11 June 2015 at 16:42, Andrew Janke <a.janke at gmail.com> wrote:
>> 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