Skip to content

file io

Christian Lück edited this page Sep 21, 2022 · 1 revision

Input and output files

Streaming

The standoff program is fully compatible with Unix-style streaming, i.e. using the output of one program as the input of the next. So, when no input and output files are given via command line parameters, it reads from standard input (stdin) and writes to standard output (stdout). Error messages and logging is written to stderr.

For example you can write:

cat INPUT_FILE | standoff COMMAND > OUTPUT_FILE

To fork output and error messages/logging write

cat INPUT_FILE | standoff COMMAND 1> OUTPUT_FILE 2> LOG_FILE

To fork output and error messages/logging and only keep the output, while errors are written to the console, write

cat INPUT_FILE | standoff command 1> OUTPUT_FILE

Reading from and writing to files

Instead of streaming, the input and/or output file can be given as global parameters:

standoff -i INPUT_FILE command [LOCAL-OPTIONS]

or

standoff --input INPUT_FILE command [LOCAL-OPTIONS]

will read from INPUT_FILE and print to stdout.

standoff -i INPUT_FILE --output OUTPUT_FILE command [LOCAL-OPTIONS]
standoff -i INPUT_FILE -o OUTPUT_FILE command [LOCAL-OPTIONS]

will write to OUTPUT_FILE instead of stdout. Error messages and logging information will still be written to stderr.

Weird defaults?

The streaming implementation is the reason for the default behaviour of the shrink command, which may seem annoying at first: When no sink for the second offset mapping is defined a format is used, where all output vectors are combined.

Exit codes

standoff will abort with a non-zero exit code on errors. In order to get this error code, use your shell's common techniques, e.g.

echo $?
Clone this wiki locally