in reply to Re: How do I append more than one files?
in thread How do I append more than one files?

This is certainly useful but in essence, would this take a longer time than usual? The reason being - we have 12 log files, running on 6 clones, and we are required to keep them for xx days but would like to 'cat' them ala Unix but the app server is running on Wintel boxes.

So far the closest thing I can find in the ActivePerl manual is this command line:

perl -MExtUtils::Command -e cat file1 file2 .. > merge_file

If I want to pass the files as parameters, can I call the above command within another perl script? So I would have a Perl script called catFiles.pl file1 file 2 > merge_file and in the script, I would have:

perl -MExtUtils::Command -e cat $arg[0] $arg1 > $arg3

but it doesnt seem to work. At the moment, I could get it to work by creating a dos batch and passing the args to the perl command, but it is not ideal. Thanks again

  • Comment on Re^2: How do I append more than one files?

Replies are listed 'Best First'.
Re^3: How do I append more than one files?
by saskaqueer (Friar) on Jun 17, 2004 at 00:12 UTC

    I think you'd want something like this to create your catFiles.pl script:

    #!perl # called as catFiles.pl input1 input2 > output exec( qw(perl -MExtUtils::Command -e cat), @ARGV );

    Or if you want a different way of executing the command:

    #!perl -w # called as catFiles.pl output input1 input2 use strict; my ($output, @inputs) = @ARGV; exec("perl -MExtUtils::Command -e cat @inputs > $output");