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. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)join.1 8.3 (Berkeley) 4/28/95
32 .\" $FreeBSD: head/usr.bin/join/join.1 235597 2012-05-18 03:30:50Z gjb $
39 .Nd relational database operator
43 .Fl a Ar file_number | Fl v Ar file_number
46 .Op Fl j Ar fileno field
58 on the specified files
59 and writes the result to the standard output.
62 is the field in each file by which the files are compared.
63 The first field in each line is used by default.
64 There is one line in the output for each pair of lines in
68 which have identical join fields.
69 Each output line consists of the join field, the remaining fields from
71 and then the remaining fields from
74 The default field separators are tab and space characters.
75 In this case, multiple tabs and spaces count as a single field separator,
76 and leading tabs and spaces are ignored.
77 The default output field separator is a single space character.
79 Many of the options use file and field numbers.
80 Both file numbers and field numbers are 1 based, i.e., the first file on
81 the command line is file number 1 and the first field is field number 1.
82 The following options are available:
83 .Bl -tag -width indent
84 .It Fl a Ar file_number
85 In addition to the default output, produce a line for each unpairable
89 Replace empty output fields with
94 option specifies the fields that will be output from each file for
95 each line with matching join fields.
99 .Ar file_number . Ns Ar field ,
104 is a field number, or the form
107 representing the join field.
108 The elements of list must be either comma
110 or whitespace separated.
111 (The latter requires quoting to protect it from the shell, or, a simpler
112 approach is to use multiple
118 as a field delimiter for both input and output.
121 in a line is significant.
122 .It Fl v Ar file_number
123 Do not display the default output, but display a line for each unpairable
130 may be specified at the same time.
143 When the default field delimiter characters are used, the files to be joined
144 should be ordered in the collating sequence of
148 option, on the fields on which they are to be joined, otherwise
150 may not report all field matches.
151 When the field delimiter characters are specified by the
153 option, the collating sequence should be the same as
159 If one of the arguments
165 the standard input is used.
169 For compatibility with historic versions of
171 the following options are available:
172 .Bl -tag -width indent
174 In addition to the default output, produce a line for each unpairable line
197 Historical implementations of
199 permitted multiple arguments to the
202 These arguments were of the form
203 .Ar file_number . Ns Ar field_number
208 This has obvious difficulties in the presence of files named
212 These options are available only so historic shell scripts do not require
213 modification and should not be used.