Skip to content

TSTool / Command / AppendFile


Overview

The AppendFile command appends one or more files to another file. All or only matching lines from input files can be transferred. This command is useful for appending multiple data files into a single file that can be read by TSTool.

Command Editor

The following dialog is used to edit the command and illustrates the command syntax.

AppendFile

AppendFile Command Editor (see also the full-size image)

Command Syntax

The command syntax is as follows:

AppendFile(Parameter="Value",...)

Command Parameters

Parameter                           Description Default          
InputFile
required
The name of one or more files to append, using the following conventions:
  • No * in filename – match one file.
  • Filename specified as *– match all files in input directory (working directory by default).
  • Filename specified as *.ext – match all files with extension

More options may be supported in the future when TSTool is updated to use Java 1.7+. Can specify using processor ${Property}.
None – must be specified.
OutputFile
required
The output file that will be appended to. The file is created if it does not exist. Use the RemoveFile command to remove the old file. Can specify using processor ${Property}. None – must be specified.
IncludeText A regular expression pattern to include text. Only the matching lines will be included. This uses the Java regular expression syntax. Append all lines.
ExcludeText A regular expression pattern to exclude text. Matching lines will be excluded from the append. Append all lines.
Newline 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.
IfNotFound Indicate action if the file is not found, one of:
  • Ignore – ignore the missing file (do not warn).
  • Warn – generate a warning (use this if the file truly is expected and a missing file is a cause for concern).
  • Fail – generate a failure (use this if the file truly is expected and a missing file is a cause for concern).
Warn

The following table lists regular expression examples:

IncludeText Regular Expression         Description
.*\Q-\E.* Match lines that start with any character, end with any character, and contain a dash. The \Q and \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.

Examples

See the automated tests.

Troubleshooting

See Also