# TAND v1.30 - intersect two data tables

#### Revised 16-Aug-97. Copyright (c) 1996-97 by Rune Berg. TextTools Freeware.

Usage - Description - Example - Options - Limitations - Return codes

### USAGE

tand [log logfile] [options] [infile1] and infile2 [to outfile]

### DESCRIPTION

tand prints, to outfile, all rows in infile2 that also appear in infile1; i.e. the intersection of the tables in infile1 and infile2.

infile1 and infile2 are ASCII text files. tand sees each input line as a row of (by default, but see -i and -a options) whitespace-separated fields; this is described in more detail in the documentation for tcols.

tand does not print duplicate rows.

tand ignores empty (whitespace only) input lines.

tand compares fields the same way as trows does.

If you don't specify infile1, tand reads from standard input.
If you don't specify outfile, tand writes to standard output.
If you don't specify logfile, tand writes error messages to standard error.

tand holds infile1 in memory while processing infile2, so you may want to specify the smaller input file first (i.e. as infile1).

### EXAMPLE

Consider the file "scooby" which contains:

            peter 18
            paul   74
            mary  9
            frank  40

and the file "doo" which contains:

            tom  100
            mary  9
            al   77
            frank 17
            peter   18

The command:

            tand scooby and doo

writes, to the screen, the rows that are common to the two files:

            mary  9
            peter   18

### OPTIONS

tand recognizes the following command line options:

Option | Function
--- | ---
-iC | Separate fields in infile1 by character C (except \). Use \t to form a tab.
-aC | Separate fields in infile2 by character C (except \). Use \t to form a tab.
-oS | Separate output fields by string S, instead of the default tab character. Use \t to form a tab.
-v | Print version banner and usage info to standard error (or logfile, if given), then exit.

### LIMITATIONS

tand handles up to 100 fields per input line.

tand runs out of memory if infile1 is too large.

### RETURN CODES

tand returns with one of the following codes ("error levels"):

Code | Meaning
--- | ---
0 | Success
101 | Out of memory
102 | Incorrect command line arguments
104 | Error opening file
105 | I/O error
106 | Capacity overrun
107 | File name clash

##### End of document