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


UsageTop | Next

tjoin [log logfile] [options] [infile1] and infile2 [to outfile] [$i=$j ...]


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


ExampleTop | 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


OptionsTop | Previous | Next

tjoin recognizes the following command line options:


LimitationsTop | Previous | Next

tjoin runs out of memory if infile1 is too large.

See also TextTools General Features.


Return CodesTop | Previous | Next

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


Version HistoryTop | Previous

These are the released versions:

End of document