|
|
coherent
join Command join
Join two data bases
jjooiinn [-aa [_n] ] [-ee _s_t_r_i_n_g ] [-jj[_n] _k_e_y_f] [-oo _n._m ...] [-tt_c] _f_i_l_e_1 _f_i_l_e_2
join processes the text files file1 and file2, each of which con-
tains a relational data base. If either file name is `-', the
standard input is used for that file.
For the purposes of join, a data base file contains a set of
records, one per input line. Each record contains a number of
fields. One field is differentiated as key field for each file.
Each file must be sorted by key field, for example with sort.
By default, the key field is the first field in each record. The
-j option changes the key field number to keyf for the desired
file. In this and other options below, the optional file number
n must be 1 to indicate file1 or 2 to indicate file2. If no n is
given, both file1 and file2 are assumed.
Normally, fields are separated by any amount of white space
(blanks or tabs). Leading blanks or tabs are not considered part
of the fields. With the -t option, the separator character is c.
With this option zero-length fields are possible; every occur-
rence of the separator ends the previous field and starts a new
one.
Output consists only of records for which the key field occurs in
both files. As a consequence of the sorted order of the input,
the output is also sorted by the key field. Each output record
has first the key field, then each field from the file1 record
but the key field, and then each field from the file2 record but
the key field. Fields are separated in the output with the
specified field character, or with a space character if no -t
option was given. Output records are always terminated with a
newline. Under the -e option, string is printed for each empty
field.
The -a option enables printing of records found in only file n.
If n is missing, unpaired records are printed from both input
files. To output only certain fields, the -o option precedes a
list of desired fields to print. Each element is of the form n.m
where n is the file number and m is the field number.
For example,
join -t: -j1 3 -o 1.3 2.4 1.4 1.1 2.2 filea fileb
joins filea and fileb which have fields separated by the colon
(`:') character. The join field number is 3 for filea and 1 (by
default) for fileb. The selected five fields are produced in the
output.
COHERENT Lexicon Page 1
join Command join
***** See Also *****
awk, comm, commands, sort, uniq
COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.