You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

concat.html 3.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="copy">Concat</a></h2>
  8. <h3>Description</h3>
  9. <p>
  10. Concatenates a file, or a series of files, to a single file or
  11. the console. The destination file will be created if it does
  12. not exist, though the the <var>append</var> attribute may be
  13. used to alter this behavior.
  14. </p>
  15. <p>
  16. <a href="../CoreTypes/fileset.html">FileSet</a>s and/or <a
  17. href="../CoreTypes/filelist.html">FileList</a>s are used to
  18. select which files are to be concatenated. There is no
  19. singular 'file' attribute to specify a single file to cat -- a
  20. fileset or filelist must also be used in these cases.
  21. </p>
  22. <h3>Parameters</h3>
  23. <table border="1" cellpadding="2" cellspacing="0">
  24. <tr>
  25. <td valign="top"><b>Attribute</b></td>
  26. <td valign="top"><b>Description</b></td>
  27. <td align="center" valign="top"><b>Required</b></td>
  28. </tr>
  29. <tr>
  30. <td valign="top">destfile</td>
  31. <td valign="top">
  32. The destination file for the concatenated stream.
  33. </td>
  34. <td valign="top" align="center">
  35. No, the console will be used as the destination for the
  36. stream in the absence of this attribute.
  37. </td>
  38. </tr>
  39. <tr>
  40. <td valign="top">append</td>
  41. <td valign="top">
  42. Specifies whether or not the file specified by 'destfile'
  43. should be overwritten. Defaults to &quot;yes&quot;.
  44. </td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">encoding</td>
  49. <td valign="top">
  50. Specifies the encoding for the input files. Please see <a
  51. 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>
  52. for a list of possible values. Defaults to the platform's
  53. default character encoding.
  54. </td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. </table>
  58. <h3>Parameters specified as nested elements</h3>
  59. <h4>fileset</h4>
  60. <p>
  61. <a href="../CoreTypes/fileset.html">FileSet</a>s are used to
  62. select files to be concatenated. Note that the order in which
  63. the files selected from a fileset are concatenated is
  64. <i>not</i> guaranteed. If this is an issue, use multiple
  65. filesets or consider using filelists.
  66. </p>
  67. <h4>filelist</h4>
  68. <p>
  69. <a href="../CoreTypes/filelist.html">FileList</a>s are used to
  70. select files to be concatenated. The file ordering in the
  71. <var>files</var> attribute will be the same order in which the
  72. files are concatenated.
  73. </p>
  74. <h3>Examples</h3>
  75. <p><b>Cat a string to a file:</b></p>
  76. <pre>
  77. &lt;cat tofile=&quot;README&quot;&gt;Hello, World!&lt;/cat&gt;
  78. </pre>
  79. <p><b>Cat a series of files to the console:</b></p>
  80. <pre>
  81. &lt;cat&gt;
  82. &lt;fileset dir=&quot;messages&quot; includes=&quot;*important*&quot; /&gt;
  83. &lt;/cat&gt;
  84. </pre>
  85. <p><b>Cat a single file, appending if the destination file exists:</b></p>
  86. <pre>
  87. &lt;cat tofile=&quot;NOTES&quot; append=&quot;true&quot;&gt;
  88. &lt;filelist dir=&quot;notes&quot; files=&quot;note.txt&quot; /&gt;
  89. &lt;/cat&gt;
  90. </pre>
  91. <p><b>Cat a series of files, overwriting if the destination file exists:</b></p>
  92. <pre>
  93. &lt;cat tofile=&quot;${docbook.dir}/all-sections.xml&quot;&gt;
  94. &lt;filelist dir=&quot;${docbook.dir}/sections&quot; files=&quot;introduction.xml,overview.xml&quot; /&gt;
  95. &lt;fileset dir=&quot;${docbook.dir}&quot; includes=&quot;sections/*.xml&quot; excludes=&quot;introduction.xml,overview.xml&quot; /&gt;
  96. &lt;/cat&gt;
  97. </pre>
  98. <hr>
  99. <p align="center">
  100. Copyright &copy; 2002 Apache Software Foundation. All
  101. Rights Reserved.
  102. </p>
  103. </body>
  104. </html>