tand prints, to outfile, all rows in infile1 that also appear in infile2; 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 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).
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
-rM : Allow for M (2..8191) rows (lines) in infile1. Default is 500.
-cN : Allow for N (2..100) columns (fields per line) in infile1. Default is 10.
-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.
The product of M and N (in -r and -c options shown above) must be no more than 16383.
tand runs out of memory if infile1 is too large.