Next Previous Up Contents
Next: tpipe: Generic Table Pipeline Utility
Up: tcopy: Table Format Converter
Previous: Usage

A.1.2 Examples

Here are some examples of tcopy in use:

tcopy stars.fits stars.xml
Copies a FITS table to a VOTable. Since no input format is specified, the format is automatically detected (FITS is one of the formats for which this is possible). Since no output format is specified, the stars.xml filename is examined to make a guess at the kind of output to write: the .xml ending is taken to mean a TABLEDATA-encoded VOTable.
tcopy -ifmt fits stars.fits -ofmt votable
Does the same as the previous example, but the input and output formats have been specified explicitly.
tcopy -ofmt text http://remote.host/data/vizer.xml.gz#4 -
Prints the contents of a remote VOTable to the terminal in a human-readable form. The #4 at the end of the URL indicates that the data from the fifth TABLE element in the remote document are to be used. The gzip compression of the table is taken care of automatically.
tcopy -ifmt csv -ofmt latex spec.csv
Converts a comma-separated values file to a LaTeX table environment.
tcopy -classpath /usr/local/jars/pg73jdbc3.jar \
      -Djdbc.drivers=org.postgresql.Driver \
      "jdbc:postgresql://localhost/imsim#SELECT ra, dec, Imag, Kmag FROM dqc" \
      -ofmt fits wfslist.cat
Writes the results of an SQL query on a PostgreSQL database to a FITS table. The classpath is augmented to include the PostgreSQL driver class, and the driver class is named using the jdbc.drivers system property. If a username or password is required, it will be prompted for on the command line. As you can see, using SQL from Java is a bit fiddly, and there are other ways to perform this setup than on the command line - see Section 2.6.


Next Previous Up Contents
Next: tpipe: Generic Table Pipeline Utility
Up: tcopy: Table Format Converter
Previous: Usage

STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note 256
STILTS web page: http://www.starlink.ac.uk/stilts/
Author email: m.b.taylor@bristol.ac.uk