JOIN(1) COMMAND REFERENCE JOIN(1)
NAME
join - relational database operator
SYNOPSIS
join [ -an ] [ -e s ] [ -jn m ] [ -o list ] [ -tc ] file1
file2
DESCRIPTION
Join forms, on the standard output, a join of the two
relations specified by the lines of file1 and file2. If
file1 is `-', the standard input is used.
File1 and file2 must be sorted in increasing ASCII collating
sequence on the fields on which they are to be joined,
normally the first in each line.
There is one line in the output for each pair of lines in
file1 and file2 that have identical join fields. The output
line normally consists of the common field, then the rest of
the line from file1, then the rest of the line from file2,
but the output format may be specified in any order by using
the -o option.
Fields are normally separated by blank, tab or newline. In
this case, multiple separators count as one, and leading
separators are discarded.
OPTIONS
-an
In addition to the normal output, produce a line for each
unpairable line in file n, where n is 1 or 2.
-e s
Replace empty output fields by string s. This must be
used with the -o option so that the correct number of
fields is known. Otherwise, the -e option is ignored.
-jn m
Join on the mth field of file n. If n is missing, use
the mth field in each file.
-o list
Each output line comprises the fields specified in list,
each element of which has the form n.m, where n is a file
number and m is a field number. The elements of the list
must be separate command line arguments.
-tc
Use character c as a separator (tab character). Every
appearance of c in a line is significant. The default
separator whitespace (tabs and spaces). Only one
separator character can be specified.
Printed 4/6/89 1
JOIN(1) COMMAND REFERENCE JOIN(1)
EXAMPLES
In the following example, the contents of the file numbers
is:
Bill 482-3659
Jane 441-3666
Sue 819-2134
and the contents of the file work_area is:
Materials Bill
Documents Jane
Management Sue
The command:
join -j1 2 work_area numbers
produces the output:
Bill Materials 482-3659
Jane Documents 441-3666
Sue Management 819-2134
and the command:
join -j2 2 numbers work_area
produces the output:
Bill 482-3659 Materials
Jane 441-3666 Documents
Sue 819-2134 Management
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
[P_ERR] A system error occurred. Execution
terminated. See intro(2) for more
information on system errors.
CAVEATS
With default field separation, the collating sequence is
that of sort -b; with -t, the sequence is that of a plain
sort.
An input file to join may have initial blank lines, but
shouldn't contain any other blank lines.
Printed 4/6/89 2
JOIN(1) COMMAND REFERENCE JOIN(1)
SEE ALSO
awk(1), comm(1), cut(1), egrep(1), fgrep(1), grep(1),
look(1), paste(1), sort(1), and uniq(1).
Printed 4/6/89 3
%%index%%
na:240,87;
sy:327,342;
de:669,1111;
op:1780,1209;
ex:3301,773;
rv:4074,444;
ca:4518,393;
se:5223,335;
%%index%%000000000135