Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

join(1) OSS Shell and Utilities Reference Manual
the sequence is that of a plain sort. To specify a tab character, enclose it in ’’(single
quotes).
-v filenum_v
Produces an output line for each unmatched line in lenum_v (where lenum_v is 1 for
le1 or 2 for le2), instead of the default output. If both -v 1 and -v 2 are specied, join
produces output lines for all unmatched lines.
DESCRIPTION
The join command reads le1 and le2, joins the lines in those les that contain common elds
or otherwise according to the ags, and writes the results to the standard output le.
The join eld is the eld in the input les that join searches to determine what will be included in
the output. One line appears in the output for each identical join eld appearing in both le1 and
le2. The output line consists of the join eld, the rest of the line from le1, then the rest of the
line from le2.
You can specify the standard input le in place of le1 or le2 by substituting a - (dash) for the
operand.
Both input les must be sorted according to the collating sequence specied by the
LC_COLLATE environment variable, if set, for the elds on which they are to be compared (by
default, the rst eld in each line).
Fields are normally separated by a space, a tab character, or a newline character. join treats con-
secutive occurrences of these separators as a single separator and discards leading separators.
Use the -t ag to specify another eld separator.
Environment Variables
This command supports the use of the LANG, LC_ALL, LC_COLLATE, LC_CTYPE,
LC_MESSAGES, and NLSPATH environment variables.
EXAMPLES
Note that the vertical alignment shown in these examples might not be consistent with your out-
put.
1. To perform a simple join operation on two les, phonedir and names, whose rst elds
contain employee last names, enter:
join phonedir names
If phonedir contains the following telephone directory:
Binst 555-6235
Dickerson 555-1842
Eisner 555-1234
Green 555-2240
Hrarii 555-0256
Janatha 555-7358
Lewis 555-3237
Takata 555-5341
Wozni 555-1234
and names contains this listing of names and department numbers:
Eisner Dept. 389
Frost Dept. 217
Green Dept. 311
Takata Dept. 454
Wozni Dept. 520
462 Hewlett-Packard Company 527188-007