1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by the University of
18 .\" California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\" may be used to endorse or promote products derived from this software
21 .\" without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" @(#)join.1 8.3 (Berkeley) 4/28/95
43 .Nd relational database operator
47 .Fl a Ar file_number | Fl v Ar file_number
50 .Op Fl j Ar file_number field
64 on the specified files
65 and writes the result to the standard output.
68 is the field in each file by which the files are compared.
69 The first field in each line is used by default.
70 There is one line in the output for each pair of lines in
74 which have identical join fields.
75 Each output line consists of the join field, the remaining fields from
77 and then the remaining fields from
80 The default field separators are tab and space characters.
81 In this case, multiple tabs and spaces count as a single field separator,
82 and leading tabs and spaces are ignored.
83 The default output field separator is a single space character.
85 Many of the options use file and field numbers.
86 Both file numbers and field numbers are 1 based, i.e. the first file on
87 the command line is file number 1 and the first field is field number 1.
88 The following options are available:
89 .Bl -tag -width indent
90 .It Fl a Ar file_number
91 In addition to the default output, produce a line for each unpairable
96 must not be preceded by a space; see the
100 Replace empty output fields with
105 option specifies the fields that will be output from each file for
106 each line with matching join fields.
110 .Ql file_number.field ,
116 The elements of list must be either comma
118 or whitespace separated.
119 (The latter requires quoting to protect it from the shell, or, a simpler
120 approach is to use multiple
126 as a field delimiter for both input and output.
129 in a line is significant.
130 .It Fl v Ar file_number
131 Do not display the default output, but display a line for each unpairable
138 may be specified at the same time.
149 When the default field delimiter characters are used, the files to be joined
150 should be ordered in the collating sequence of
154 option, on the fields on which they are to be joined, otherwise
156 may not report all field matches.
157 When the field delimiter characters are specified by the
159 option, the collating sequence should be the same as
165 If one of the arguments
171 the standard input is used.
175 utility exits 0 on success, and >0 if an error occurs.
177 For compatibility with historic versions of
179 the following options are available:
180 .Bl -tag -width indent
182 In addition to the default output, produce a line for each unpairable line
183 in both file 1 and file 2.
184 (To distinguish between this and
185 .Fl a Ar file_number ,
187 currently requires that the latter not include any white space.)
199 field of both file 1 and file 2.
201 Historical implementations of
203 permitted multiple arguments to the
206 These arguments were of the form
207 .Ql file_number.field_number
212 This has obvious difficulties in the presence of files named
216 These options are available only so historic shellscripts don't require
217 modification and should not be used.
221 command is expected to be