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.
一つ以上のファイルを連結して、一つのファイルまたはコンソールに出力します。 出力先ファイルが存在しない場合、生成されます。
Paths and/or FileSets and/or FileLists are used to select which files are to be concatenated. There is no singular 'file' attribute to specify a single file to cat.
path、 fileset、 filelist で、連結したいファイルを指定します。 単一ファイルを指定するための'file'属性は使えません。
| Attribute | Description | Required |
| destfile | The destination file for the concatenated stream. If not specified the console will be used instead. | No |
| append | Specifies whether or not the file specified by 'destfile' should be appended. Defaults to "no". | No |
| force | Specifies whether or not the file specified by 'destfile' should be written to even if it is newer than all source files. since Ant 1.6. Defaults to "yes". | No |
| encoding | Specifies the encoding for the input files. Please see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html for a list of possible values. Defaults to the platform's default character encoding. | No |
| outputencoding | The encoding to use when writing the output file since Ant 1.6. Defaults to the value of the encoding attribute if given or the default JVM encoding otherwise. | No |
| fixlastline | Specifies whether or not to check if each file concatenated is terminated by a new line. If this attribute is "yes" a new line will be appended to the stream if the file did not end in a new line. since Ant 1.6. Defaults to "no". This attribute does not apply to embedded text. | No |
| eol |
Specifies what the end of line character are
for use by the fixlastline attribute.
since Ant 1.6
Valid values for this property are:
|
No |
| 属性 | 説明 | 必須 |
| destfile | 連結したストリームの出力先ファイル。 指定しない場合はコンソールとなります。 | No |
| append | 'destfile'で指定したファイルに追記するかどうかを指定します。 デフォルトは "no" です。 | No |
| force | Specifies whether or not the file specified by 'destfile' should be written to even if it is newer than all source files. 'destfile'で指定したファイルがソースファイルより新しい場合にも処理するかどうかを指定します。 Ant 1.6〜. デフォルトは "yes" | No |
| encoding | 入力ファイルのエンコーディングを指定します。 利用可能な値の一覧については、 Specifies the encoding for the input files. Please see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html を見てください。 デフォルトは、プラットフォームのデフォルト文字エンコーディングです。 | No |
| outputencoding | 出力ファイルのエンコーディングを指定します。 Ant 1.6〜. デフォルトは、指定されていれば encoding属性に準じ、 指定されていなければJVMのデフォルトエンコーディングを使います。 | No |
| fixlastline | 連結する各ファイルの最後が改行で終わるかどうかをチェックします。 "yes" を指定すると、ファイル末尾に改行を補います。 Ant 1.6〜。 デフォルトは "no"です。 エンベッドテキストには適用されません。 | No |
| eol |
fixlastline で使用する改行文字を指定します。
Ant 1.6〜。
指定できる値は:
|
No |
since Ant 1.6.
Ant 1.6〜。
This is a Path. This is used to select file files to be concatenated. Note that a file can only appear once in a path. If this is an issue consider using multiple paths.
Pathを使って、連結したいファイルを指定します。 それぞれのパスにはファイルを一回だけ指定できます。 必要に応じて複数のパスを指定してください。
FileSets are used to select files to be concatenated. Note that the order in which the files selected from a fileset are concatenated is not guaranteed. If this is an issue, use multiple filesets or consider using filelists.
FileSets are used to FileSetを使って、連結したい一連のファイルを指定します。 ファイルセットで選択したファイルの接続順序は保証されません。 これが問題であれば、複数のファイルセットを使うか、filelist の利用を検討してください。
FileLists are used to select files to be concatenated. The file ordering in the files attribute will be the same order in which the files are concatenated.
FileList を使って、連結したい一連のファイルを指定します。 files 属性で指定した順序で連結されます。
since Ant 1.6.
Ant 1.6〜。
The concat task supports nested FilterChains.
concatタスクは FilterChain内部要素をサポートしています。
since Ant 1.6.
Ant 1.6〜。
Used to prepend or postpend text into the concatenated stream.
連結ファイルの前、または後に接続するテキストを指定します。
The text may be in-line or be in a file.
テキストはインラインかファイルで指定します。
| Attribute | Description | Required |
| filtering | Whether to filter the text provided by this sub element, default is "yes". | No |
| file | A file to place at the head or tail of the concatenated text. | No |
| trim | Whether to trim the value, default is "no" | No |
| trimleading | Whether to trim leading white space on each line, default is "no" | No |
| 属性 | 説明 | 必須 |
| filtering | このサブ要素で指定するテキストをフィルタするかどうかを指定します。 デフォルトは "Yes"です。 | No |
| file | 連結したファイルの、ヘッダまたはフッタとして用いるファイルを指定します。 | No |
| trim | 値の前後の空白を取り除くかどうか指定します。 デフォルトは "no"です。 | No |
| trimleading | 各行の先頭にある空白文字を取り除くかどうか指定します。 デフォルトは "no"です。 | No |
Concatenate a string to a file:
文字列を連結してファイルに出力します:
<concat destfile="README">Hello, World!</concat>
Concatenate a series of files to the console:
一連のファイルを連結してコンソールに出力します:
<concat>
<fileset dir="messages" includes="*important*"/>
</concat>
Concatenate a single file, appending if the destination file exists:
一つのファイルを出力します。出力先ファイルがあれば追記します:
<concat destfile="NOTES" append="true">
<filelist dir="notes" files="note.txt"/>
</concat>
Concatenate a series of files, update the destination file only if is older that all the source files:
出力ファイルが古い場合のみ、一連のファイルを連結してファイルに出力します:
<concat destfile="${docbook.dir}/all-sections.xml"
force="no">
<filelist dir="${docbook.dir}/sections"
files="introduction.xml,overview.xml"/>
<fileset dir="${docbook.dir}"
includes="sections/*.xml"
excludes="introduction.xml,overview.xml"/>
</concat>
Concatenate a series of files, expanding ant properties
一連のファイルを連結し、antプロパティを展開します:
<concat destfile="${build.dir}/subs">
<path>
<fileset dir="${src.dir}" includes="*.xml"/>
<pathelement location="build.xml"/>
</path>
<filterchain>
<expandproperties/>
</filterchain>
</concat>
Filter the lines containing project from build.xml and output them to report.output, prepending with a header
build.xml から project を含む行を取り出し、ヘッダを付加して report.output に出力します:
<concat destfile="${build.dir}/report.output">
<header filtering="no" trimleading="yes">
Lines that contain project
==========================
</header>
<path path="build.xml"/>
<filterchain>
<linecontains>
<contains value="project"/>
</linecontains>
</filterchain>
</concat>
Copyright © 2002-2004 The Apache Software Foundation. All
Rights Reserved.
[訳注:これは漆島賢二の訳を参考に、的場が翻訳しました。日本語訳に対するコメントがあれば
report@jajakarta.orgに送ってください]