TSTool / Command / AppendFile
AppendFile command appends text to a file.
This command is useful for:
- appending multiple data files into a single file that can be read by TSTool
- formatting files for use in websites (see also the
The command appends to a file using either of the following:
- one or more files can be appended to create a new file or overwrite an input file
- text can be added to the input file to create a new file or overwrite the input file
The list of input files can be specified using a single pattern or a comma-separated list of patterns, each of which can be specified as:
- absolute path
- a path relative to the command file folder
- literal path (no wildcards) that exactly matches a file
- wildcards to match one or more files
*- match one or more characters at a folder level
*.abc- matches file names with extension
**/*.abc- matches file names with extension
abcin any folder
All or only matching lines from input files can be transferred using
The following dialog is used to edit the command and illustrates the command syntax.
AppendFile Command Editor (see also the full-size image)
The command syntax is as follows:
|The name of one or more files to append, specified as file patterns separated by commas:
Can specify using processor
|Specify file pattern(s) or text to append.
|Text to append to the input file.
InputFile or text.
|The output file that will be created from input. The file is created if it does not exist. If the output file matches an input file, the input file will be overwritten. Use the
RemoveFile command to remove the old file. Can specify using processor
|None – must be specified.
|A regular expression pattern to include text. Only the matching lines will be included.
* can be used as wildcard to match beginning and ending of a string. The
* is converted to
.* and the pattern uses the Java regular expression syntax.
|Append all lines.
|A regular expression pattern to exclude text.
* can be used as wildcard to match beginning and ending of a string. Matching lines will be excluded from the append.
|Append all lines.
|Indicate the newline character to use at the end of lines. Normally the operating system default is ok (
\n for Linux and for Mac,
\r\n for Windows), but the newline may need to be specified to ensure cross-platform compatibility.
|Operating system default.
|Indicate action if the file is not found, one of:
The following table lists regular expression examples:
IncludeText Regular Expression
|Match lines that start with any character, end with any character, and contain a dash. The
\E characters are special characters to start and end a quoted character, and are necessary because the dash has special meaning in a regular expression.
See the automated tests.