[clug] Thursday afternoon Perl/bash golf time
a.janke at gmail.com
Thu Jun 11 04:06:08 MDT 2015
> Konsole output
> $ find . -maxdepth 1 -name \*.dat -print | sort | xargs --max-args=1 cat >>
> 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
A few others also suggested shell versions, the problem is that this
is buried within an existing perl script that does a number of other
things so any shell things have to be one liners, no redirection or
piping allowed. Well, you can do this but then you let yourself in for
all sorts of malarkey in Perl with a system() call. There are a few
CPAN modules that make this a little easier but it's still malarkey
and then requires the user to install extra stuff. This code is used
by a reasonable userbase so this also precludes using anything that is
slightly sensitive to spaces in filenames which incidentally my
initial version is.
Once day I'll get around to converting all these things to python, but
for now I'm a happy Perl Dinosaur.
More information about the linux