TJOIN v2.00 - join two related data tables |
Revised 2-Jan-99. Copyright (c) 1996-99 by Rune Berg. TextTools Freeware. |
Usage | Description | Example | Options | Limitations | Return Codes | Version History | tt_r6
Usage | Top | Next |
tjoin [log logfile] [options] [infile1] and infile2 [to outfile] [$i=$j ...]
Description | Top | Previous | Next |
tjoin prints, to outfile, the join of the tables in infile1 and infile2, optionally using predicates to restrict output.
infile1 and infile2 are ASCII text files. tjoin 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.
tjoin ignores empty (whitespace only) input lines.
tjoin compares fields the same was as trows does.
Predicates of form $i=$j (where i and j are numbers in the range [DOS: 1..100; Win32: 1..400]) restrict output to the cases where the i'th field in infile1 is equal to the j'th field in infile2.
If you don't specify infile1, tjoin reads from standard input.
If you don't specify outfile, tjoin writes to standard output.
If you don't specify logfile, tjoin writes error messages to standard
error.
tjoin holds infile1 in memory while reading infile2, so you may want to specify the smaller input file as infile1.
Example | Top | Previous | Next |
For example, consider the file "boys" containing the table:
john tennis john golf tim surfing al tennis
and the file "girls" containg the table:
sue golf lisa tennis
The command:
tjoin boys and girls
produces the output below, all possible pairs of the data sets from the two files:
john tennis sue golf john golf sue golf tim surfing sue golf al tennis sue golf john tennis lisa tennis john golf lisa tennis tim surfing lisa tennis al tennis lisa tennis
For example, to find sports partners, use the command:
tjoin boys and girls $2=$2
to produce the output below, all pairs of the data sets from the two files where the second fields are equal:
john golf sue golf john tennis lisa tennis al tennis lisa tennis
Options | Top | Previous | Next |
tjoin 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. |
-fppN | Use floating-point precision N (0..15, default 6) decimal digits for comparisons. See separate discussion on floating point numbers for more details. |
-v | Print version banner and usage info to standard error (or logfile, if given), then exit. |
Limitations | Top | Previous | Next |
tjoin runs out of memory if infile1 is too large.
See also TextTools General Features.
Return Codes | Top | Previous | Next |
tjoin 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 |
109 | Too few fields to satisfy predicate |
Version History | Top | Previous |
These are the released versions:
Version | Date | Changes |
---|---|---|
1.02 | 25-Feb-96 | n/a |
1.10 | 25-Sep-96 | * Very minor changes. |
1.20 | 8-Mar-97 | * Available as Win32 version. * Removed options -r and -c. |
1.30 | 13-Jul-97 | * Proper return codes. |
2.00 | 2-Jan-99 | * Field comparison now supports floating-point numbers. * Win32 version has increased max. input line length / fields per line. * Win32 version now shows coloured reponse texts. |
End of document |