1 .\" $NetBSD: join.1,v 1.13 2012/04/08 22:00:39 wiz Exp $
3 .\" Copyright (c) 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" from: @(#)join.1 8.3 (Berkeley) 4/28/95
34 .\" $NetBSD: join.1,v 1.13 2012/04/08 22:00:39 wiz Exp $
41 .Nd relational database operator
44 .Op Fl a Ar file_number | Fl v Ar file_number
46 .Op Fl j Ar file_number field
53 The join utility performs an ``equality join'' on the specified files
54 and writes the result to the standard output.
55 The ``join field'' is the field in each file by which the files are compared.
56 The first field in each line is used by default.
57 There is one line in the output for each pair of lines in
61 which have identical join fields.
62 Each output line consists of the join field, the remaining fields from
64 and then the remaining fields from
67 The default field separators are tab and space characters.
68 In this case, multiple tabs and spaces count as a single field separator,
69 and leading tabs and spaces are ignored.
70 The default output field separator is a single space character.
72 Many of the options use file and field numbers.
73 Both file numbers and field numbers are 1 based, i.e. the first file on
74 the command line is file number 1 and the first field is field number 1.
75 The following options are available:
77 .It Fl a Ar file_number
78 In addition to the default output, produce a line for each unpairable
83 must not be preceded by a space; see the
87 Replace empty output fields with
92 option specifies the fields that will be output from each file for
93 each line with matching join fields.
97 .Ql file_number.field ,
103 The elements of list must be either comma (``,'') or whitespace separated.
104 (The latter requires quoting to protect it from the shell, or, a simpler
105 approach is to use multiple
111 as a field delimiter for both input and output.
114 in a line is significant.
115 .It Fl v Ar file_number
116 Do not display the default output, but display a line for each unpairable
123 may be specified at the same time.
134 When the default field delimiter characters are used, the files to be joined
135 should be ordered in the collating sequence of
139 option, on the fields on which they are to be joined, otherwise
141 may not report all field matches.
142 When the field delimiter characters are specified by the
144 option, the collating sequence should be the same as
150 If one of the arguments
154 is ``-'', the standard input is used.
158 utility exits 0 on success, and \*[Gt]0 if an error occurs.
160 For compatibility with historic versions of
162 the following options are available:
165 In addition to the default output, produce a line for each unpairable line
166 in both file 1 and file 2.
167 (To distinguish between this and
168 .Fl a Ar file_number ,
170 currently requires that the latter not include any white space.)
182 field of both file 1 and file 2.
184 Historical implementations of
186 permitted multiple arguments to the
189 These arguments were of the form ``file_number.field_number'' as described
193 This has obvious difficulties in the presence of files named ``1.2''.
196 These options are available only so historic shell scripts don't require
197 modification and should not be used.
207 command is expected to be