Next Previous Up Contents
Next: tcube: Calculates N-dimensional histograms
Up: tcopy: Converts between table formats
Previous: Usage

### B.28.2 Examples

Here are some examples of `tcopy` in use:

    stilts 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.

    stilts tcopy stars.fits stars.xml ifmt=fits ofmt=votable

  Does the same as the previous example, but the input and output formats have been specified explicitly.

    stilts tcopy ofmt=text http://remote.host/data/vizer.xml.gz#4 -

  Prints the contents of a remote, compressed 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.

    stilts tcopy ifmt=csv ofmt=latex spec.csv

  Converts a comma-separated values file to a LaTeX table environment, writing the result to standard output.

    stilts -classpath /usr/local/jars/pg73jdbc3.jar \
           -Djdbc.drivers=org.postgresql.Driver \
           tcopy in="jdbc:postgresql://localhost/imsim#SELECT ra, dec, Imag FROM dqc" \
                 ofmt=fits wfslist.cat

  Makes an SQL query on a PostgreSQL database and writes the results to a FITS file. The whole command is shown here, to show that the classpath is augmented to include the PostgreSQL driver class, and the driver class is named using the `jdbc.drivers` system property. 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 3.4 and `tpipe`'s `omode=tosql` output mode.

Next Previous Up Contents
Next: tcube: Calculates N-dimensional histograms
Up: tcopy: Converts between table formats
Previous: Usage

STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note256
STILTS web page: http://www.starlink.ac.uk/stilts/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@jiscmail.ac.uk