Cat

Description

Concatenates a file, or series of files to a single file, or the console. The destination file will be created if it does not exist, though the the append attribute may be used to alter this behavior.

FileSets are used to select which files are to be concatenated. There is no singular 'file' attribute to specify a single file to cat. A file set must also be used in these cases.

Parameters

Attribute Description Required
tofile The file to copy the concatenated stream to. No, the console will be used as the destination for the stream in the absence of this attribute.
append Specifies whether or not the file specified by 'tofile' should be overwritten. Defaults to "yes". No

Parameters specified as nested elements

fileset

FileSets are used to select which files are to be concatenated. There is no singular 'file' attribute to specify a single file to cat. A file set must also be used in these cases.

Examples

Cat a string to a file:

  <cat tofile="README">Hello, World!</cat>
      

Cat a series of files to the console:

  <cat>
    <fileset dir="messages" includes="*important*" />
  </cat>
      

Cat a single file, appending if the destination file exists:

  <cat tofile="NOTES" append="true">
    <fileset dir="notes" includes="note.txt" />
  </cat>
      

Cat a series of files, overwriting if the destination file exists:

  <cat tofile="${docbook.dir}/all-sections.xml">
    <fileset dir="${docbook.dir}" includes="**/sections/*.xml" />
  </cat>
      

Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.