Or, as a last resort, simply call a Java program to do this. It really should be 
written as a task, of course, but for lack of time and conceptual simplicity, we use 
it now as just an external Java program. Call it with redirecting the output of the 
"java" task to the destination file.


The trivial Java code would be something like


// Mini-utility to cat a number of files. Just like
// Unix "cat", but this works on any box.
//
// java Cat file1 [file2 ...]

import java.io.*;

public class Cat
{
    public static void main(String[] args)
        throws Exception
    {
        for (int i=0; i<args.length; i++) {
            File f = new File(args[i]);
            System.out.println();
            if (f.exists()) {
                BufferedReader r = new BufferedReader(new FileReader(f));
                String line;
                do {
                    line = r.readLine();
                    if (line != null) {
                        System.out.println(line);
                    }
                } while (line != null);
                r.close();
            } else {
                System.out.println("# No file \"" + args[i] + "\"");
            }
        }
    }
}

Reply via email to