[clug] Thursday afternoon Perl/bash golf time

Brett Worth brett.worth at gmail.com
Thu Jun 11 01:17:16 MDT 2015


On 11/06/15 16:42, Andrew Janke wrote:
>> cat failed? shell didn't pass the large number of args? Perl failed?
> Sorry, yes shell failed from too many arguments.

If it's just the argument count that's a problem then find and xargs can help:

Konsole output
$ find . -maxdepth 1 -name \*.dat -print | sort | xargs --max-args=1 cat >> /tmp/all.raw

The list coming out of find is unsorted so you need the sort else the files will be 
appended out of order.

Or if you do really want to use infiles.txt with a list of pre-sorted file names in it:

$ cat infiles.txt | xargs --max-args=1 cat >> /tmp/all.raw

Brett

-- 
   /) _ _ _/_/ / / /  _ _//
  /_)/</= / / (_(_/()/< ///



More information about the linux mailing list