B Tablecopy

By loading a table in one format and saving it to another it is possible to use TOPCAT to convert tabular data between supported input and output formats.

However, if this is all that you want to do, there is a a more convenient way of doing it from the command line. This avoids the overhead of starting up the GUI, prevents you having to point and click, and may also make more efficient use of memory.

Tables can be copied between formats using the 'tablecopy' command. If you have the full Unix installation this can be invoked using the bin/tablecopy shell script. Alternatively, it can be invoked from the jar file by doing

   java -classpath topcat.jar  uk.ac.starlink.table.TableCopy [args]
(the topcat-full.jar, topcat-lite.jar or tablecopy.jar jarfiles can be used instead if those are what you have). All the commments about classpaths and arguments to Java itself described in the section on Invoking TOPCAT apply here as well.

The command is straightforward to use. Typing

    tablecopy -help
(or java -classpath topcat.jar uk.ac.starlink.table.TableCopy -help) produces the following usage message:
Usage: TableCopy [-disk] [-debug] [-h[elp]] [-v[erbose]]
                 [-ifmt <in-format>] [-ofmt <out-format>]
                 <in-table> <out-table>

   Auto-detected in-formats:
      fits-plus
      fits
      votable

   Known in-formats:
      fits-plus
      fits
      votable
      ascii
      csv
      wdc

   Known out-formats:
      jdbc
      fits
      fits-plus
      fits-basic
      votable-tabledata
      votable-binary-inline
      votable-fits-href
      votable-binary-href
      votable-fits-inline
      text
      ascii
      csv
      html
      html-element
      latex
      latex-document
      mirage

The flags and arguments have the following meaning:

-disk
Causes temporary files to be used for backing store when table data must be stored. Use this flag if you're getting an OutOfMemoryError otherwise.
-debug
Causes some logging and error reporting to be more verbose than usual.
-verbose
Causes progress to be reported on standard error during table reading, and possibly some additional logging messages.
-help
Prints a usage message to standard output.
-ifmt in-format
Specifies the input format to be used (one of the known in-formats listed above - matching is case-insensitive). This flag can be used if you know what format your input table is in. If it's omitted, then an attempt will be made to detect the format of in-table automatically, but this cannot always be done correctly, in which case the program will exit with an error explaining which formats were attempted.
-ofmt out-format
Specifies the output format to be used (one of the known out-formats listed above - matching is case-insensitive). This flag can be used to determine what format to write to. If it's omitted, then the output filename will be examined to try to guess what sort of file is required (e.g. by looking at the extension). If it doesn't look like any particular known type, the program will exit with an error.
in-table
Location of the input table. This is typically a filename or URL.
out-table
Location of the output table. This is typically a filename to write to. In some cases it can be the special string "-" to indicate output to the standard output stream.

Here are some examples of use: