Next Previous Up Contents
Next: tcatn: Concatenates multiple tables
Up: tcat: Concatenates multiple similar tables
Previous: Usage

### B.26.2 Examples

Here are some examples of `tcat`:

    stilts tcat ifmt=ascii in=t1.txt in=t2.txt in=t3.txt out=table.txt

  Concatenates the three named ASCII format tables to produce an output table. All three must have compatible numbers and types of columns.

    stilts tcat ifmt=ascii in="t1.txt t2.txt t3.txt" out=table.txt

  Has exactly the same effect as the previous example.

    stilts tcat ifmt=ascii in=@inlist.lis out=table.txt

  This will have the same effect as the previous two examples if a file name "inlist.lis" in the current directory contains three lines, "t1.txt", "t2.txt" and "t3.txt".

    stilts tcat in=@infits.lis out=gaia_source.colfits
                lazy=true countrows=true

  Concatenates the contents of all the files listed in "infits.lis" to one large output colfits file. The `lazy=true` is a good idea if there is a large number of input files listed.

    stilts tcat in=r368776.fits#1 in=r368776#2 in=r368776.fits#3 in=r368776.fits#4
                out=r368776_all.fits

  Concatenates the contents of four tables (the first four extension HDUs) from a multi-extension FITS file to produce a single FITS table. Many Unix shells (csh, bash) will allow you to list the input files using the following shorthand: "`in=r368776.fits#{1,2,3,4}`".

    stilts tcat in=r368776.fits multi=true out=r368776_all.fits

  Concatenates all the tables in the named file together. Setting `multi=true` means that instead of picking the first table from each named `in` table, all tables will be selected. So, if the input FITS file in this example has just four table HDUs, then this example does exactly the same as the previous one, but with less typing. The same thing works with multi-TABLE VOTable documents, but most other file formats (CSV etc) do not have the facility for storing multiple tables in a single file.

    stilts tcat in=r368776.fits multi=true out=r368776_all.fits
                icmd=progress seqcol=ID

  Does the same as the previous example with a couple of additions. Firstly, progress through each of the input files will be reported to the console. Secondly, an additional column "ID" will be appended to the output which contains 1 for all the rows from the first input table, 2 for the rows from the second one and so on.

    stilts tcat in='rA.csv rB.csv rC.csv' ifmt=csv \
                icmd='keepcols "RA DEC FLUX"' icmd='sorthead 10 FLUX' \
                ocmd='sort FLUX'

  Takes the 10 rows with highest FLUX values from each of three input tables (in comma-separated value format) and joins them together to produce a 30-row output table. This is then sorted in FLUX order, and the resulting table is output to the console in text format. Only the columns RA, DEC and FLUX are output; any other columns are discarded. The input tables don't need to have identical forms to each other, but each must have at least an RA, DEC and FLUX column.

    stilts tcat in=vizier.xml multi=true
                icmd='keepcols "ucd$RECORD ucd$POS_EQ_RA_MAIN ucd$POS_EQ_DEC_MAIN"'
                uloccol=TID out=all.csv

  This processes a VOTable file which may have multiple TABLEs in it, but for which each of the tables is known to have columns with the UCDs RECORD, POS_EQ_RA_MAIN and POS_EQ_DEC_MAIN (this is typical of VOTables retrieved from CDS's VizieR service). It retains only those columns from each table and writes the result as a single concatenated table to a CSV file.

Next Previous Up Contents
Next: tcatn: Concatenates multiple tables
Up: tcat: Concatenates multiple similar tables
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