JOIN(1) UNIX Reference Manual JOIN(1) NNAAMMEE jjooiinn - relational database operator SSYYNNOOPPSSIISS jjooiinn [--aa _f_i_l_e__n_u_m_b_e_r] [--ee _s_t_r_i_n_g] [--jj _f_i_l_e__n_u_m_b_e_r _f_i_e_l_d] [--oo _l_i_s_t] [--tt _c_h_a_r] [--vv _f_i_l_e__n_u_m_b_e_r] [_f_i_e_l_d] [--22 _f_i_e_l_d] _f_i_l_e_1 _f_i_l_e_2 DDEESSCCRRIIPPTTIIOONN The join utility performs an ``equality join'' on the files _f_i_l_e_1 and _f_i_l_e_2. The joined files are written to the standard output. The ``join field'' is a field in each file on which the files are com- pared. There is one line in the output for each pair of lines in _f_i_l_e_1 and _f_i_l_e_2 which have identical join fields. The output line by default consists of the join field, then the remaining fields from _f_i_l_e_1, then the remaining fields from _f_i_l_e_2. This format can be changed by using the --oo option (see below). The files file1 and file2 should be ordered in the collating sequence of sort -b on the fields on which they are to be joined, by default the first in each line; Otherwise, all join field matches need not be report- ed. The default input field separators are <blank>s. In this case, multiple separators count as one field separator, and leading separators are ig- nored. The default output field separator is a <space>. The following options are available: --aa _f_i_l_e__n_u_m_b_e_r In addition to the default output, produce a line for each unpairable line in file _f_i_l_e__n_u_m_b_e_r, where _f_i_l_e__n_u_m_b_e_r is 1 or 2. --ee _s_t_r_i_n_g Replace empty output fields by the string _s_t_r_i_n_g. --jj _f_i_l_e__n_u_m_b_e_r _f_i_e_l_d Join on the _f_i_e_l_d'th field of file _f_i_l_e__n_u_m_b_e_r. If _f_i_l_e__n_u_m_b_e_r is missing, (i.e., the first digit of the option argument is neither 1 nor 2), use the _f_i_e_l_d'th field in each file. Fields are decimal integers starting with 1. --oo _l_i_s_t Each output line comprises the fields specified in _l_i_s_t, each element of which has the form `file_number.field', where _f_i_l_e__n_u_m_b_e_r is a file number and field is a decimal integer field number. The elements of list are either comma or <space> separated. The list is written only for lines with matching join fields, and is not output unless specifically requested. --tt _c_h_a_r Use character _c_h_a_r as a separator, for both input and output. Every appearance of char in a line is significant. When this option is specified, the collating sequence should be the same as sort without the --bb option. --vv _f_i_l_e__n_u_m_b_e_r Instead of the default output, produce a line only for each unpairable line in _f_i_l_e__n_u_m_b_e_r, where _f_i_l_e__n_u_m_b_e_r is 1 or 2. --11 _f_i_e_l_d Join on the _f_i_e_l_d'th field of file 1. Fields are decimal integers starting with 1. --22 _f_i_e_l_d Join on the _f_i_e_l_d'th field of file 2. Fields are decimal integers starting with 1. If both `-a 1' and `-a 2' are specified, both sets of information are output, `-a 2' always first, regardless of the specified order. The following arguments are required: _f_i_l_e_1 _f_i_l_e_2 A pathname of a file to be joined. If either of the _f_i_l_e_1 or _f_i_l_e_2 arguments is `--' the standard input is used in its place. The jjooiinn utility exits 0 on success, and >0 if an error occurs. SSTTAANNDDAARRDDSS The jjooiinn function is expected to be POSIX 1003.2 compatible. SSEEEE AALLSSOO awk(1) comm(1), look(1) sort(1), uniq(1), BBUUGGSS The conventions of jjooiinn join(1), comm(1), sort(1), uniq(1), look(1) and awk(1) are wildly incongruous.