mirror of
https://github.com/apache/ant.git
synced 2025-05-18 22:14:47 +00:00
138 lines
3.9 KiB
HTML
138 lines
3.9 KiB
HTML
|
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Language" content="en-us">
|
||
|
<title>Ant User Manual</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<h2><a name="copy">Concat</a></h2>
|
||
|
|
||
|
<h3>Description</h3>
|
||
|
|
||
|
<p>
|
||
|
Concatenates a file, or a series of files, to a single file or
|
||
|
the console. The destination file will be created if it does
|
||
|
not exist, though the the <var>append</var> attribute may be
|
||
|
used to alter this behavior.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
<a href="../CoreTypes/fileset.html">FileSet</a>s and/or <a
|
||
|
href="../CoreTypes/filelist.html">FileList</a>s are used to
|
||
|
select which files are to be concatenated. There is no
|
||
|
singular 'file' attribute to specify a single file to cat -- a
|
||
|
fileset or filelist must also be used in these cases.
|
||
|
</p>
|
||
|
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<table border="1" cellpadding="2" cellspacing="0">
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top"><b>Attribute</b></td>
|
||
|
<td valign="top"><b>Description</b></td>
|
||
|
<td align="center" valign="top"><b>Required</b></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top">destfile</td>
|
||
|
<td valign="top">
|
||
|
The destination file for the concatenated stream.
|
||
|
</td>
|
||
|
<td valign="top" align="center">
|
||
|
No, the console will be used as the destination for the
|
||
|
stream in the absence of this attribute.
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top">append</td>
|
||
|
<td valign="top">
|
||
|
Specifies whether or not the file specified by 'destfile'
|
||
|
should be overwritten. Defaults to "yes".
|
||
|
</td>
|
||
|
<td valign="top" align="center">No</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top">encoding</td>
|
||
|
<td valign="top">
|
||
|
Specifies the encoding for the input files, used only when
|
||
|
concatenating files to the console. Please see <a
|
||
|
href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html">http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html</a>
|
||
|
for a list of possible values. Defaults to the platform's
|
||
|
default character encoding.
|
||
|
</td>
|
||
|
<td valign="top" align="center">No</td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
|
||
|
<h3>Parameters specified as nested elements</h3>
|
||
|
|
||
|
<h4>fileset</h4>
|
||
|
|
||
|
<p>
|
||
|
<a href="../CoreTypes/fileset.html">FileSet</a>s are used to
|
||
|
select files to be concatenated. Note that the order in which
|
||
|
the files selected from a fileset are concatenated is
|
||
|
<i>not</i> guaranteed. If this is an issue, use multiple
|
||
|
filesets or consider using filelists.
|
||
|
</p>
|
||
|
|
||
|
<h4>filelist</h4>
|
||
|
|
||
|
<p>
|
||
|
<a href="../CoreTypes/filelist.html">FileList</a>s are used to
|
||
|
select files to be concatenated. The file ordering in the
|
||
|
<var>files</var> attribute will be the same order in which the
|
||
|
files are concatenated.
|
||
|
</p>
|
||
|
|
||
|
<h3>Examples</h3>
|
||
|
|
||
|
<p><b>Cat a string to a file:</b></p>
|
||
|
|
||
|
<pre>
|
||
|
<cat tofile="README">Hello, World!</cat>
|
||
|
</pre>
|
||
|
|
||
|
<p><b>Cat a series of files to the console:</b></p>
|
||
|
|
||
|
<pre>
|
||
|
<cat>
|
||
|
<fileset dir="messages" includes="*important*" />
|
||
|
</cat>
|
||
|
</pre>
|
||
|
|
||
|
<p><b>Cat a single file, appending if the destination file exists:</b></p>
|
||
|
|
||
|
<pre>
|
||
|
<cat tofile="NOTES" append="true">
|
||
|
<filelist dir="notes" files="note.txt" />
|
||
|
</cat>
|
||
|
</pre>
|
||
|
|
||
|
<p><b>Cat a series of files, overwriting if the destination file exists:</b></p>
|
||
|
|
||
|
<pre>
|
||
|
<cat tofile="${docbook.dir}/all-sections.xml">
|
||
|
<filelist dir="${docbook.dir}/sections" files="introduction.xml,overview.xml" />
|
||
|
<fileset dir="${docbook.dir}" includes="sections/*.xml" excludes="introduction.xml,overview.xml" />
|
||
|
</cat>
|
||
|
</pre>
|
||
|
|
||
|
<hr>
|
||
|
|
||
|
<p align="center">
|
||
|
Copyright © 2002 Apache Software Foundation. All
|
||
|
Rights Reserved.
|
||
|
</p>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|