BSD 3 development
[unix-history] / usr / man / man1 / join.1
CommitLineData
e6817382
BJ
1.TH JOIN 1
2.SH NAME
3join \- relational database operator
4.SH SYNOPSIS
5.B join
6[
7options
8]
9file1 file2
10.SH DESCRIPTION
11.I Join
12forms, on the standard output,
13a join
14of the two relations specified by the lines of
15.I file1
16and
17.IR file2 .
18If
19.I file1
20is `\-', the standard input is used.
21.PP
22.I File1
23and
24.I file2
25must be sorted in increasing ASCII collating
26sequence on the fields
27on which they are to be joined,
28normally the first in each line.
29.PP
30There is one line in the output
31for each pair of lines in
32.I file1
33and
34.I file2
35that have identical join fields.
36The output line normally consists of the common field,
37then the rest of the line from
38.IR file1 ,
39then the rest of the line from
40.IR file2 .
41.PP
42Fields are normally separated by blank, tab or newline.
43In this case, multiple separators count as one, and
44leading separators are discarded.
45.PP
46These options are recognized:
47.TP
48.BI \-a n
49In addition to the normal output,
50produce a line for each unpairable line in file
51.IR n ,
52where
53.I n
54is 1 or 2.
55.TP
56.BI \-e \ s
57Replace empty output fields by string
58.IR s .
59.TP
60.BI \-j n\ m
61Join on the
62.IR m th
63field of file
64.IR n .
65If
66.I n
67is missing, use the
68.IR m th
69field in each file.
70.TP
71.BI \-o \ list
72Each output line comprises the fields specifed in
73.IR list ,
74each element of which has the form
75.IR n . m ,
76where
77.I n
78is a file number and
79.I m
80is a field number.
81.PP
82.TP
83.BI \-t c
84Use character
85.I c
86as a separator (tab character).
87Every appearance of
88.I c
89in a line is significant.
90.SH "SEE ALSO"
91sort(1), comm(1), awk(1)
92.SH BUGS
93With default field separation,
94the collating sequence is that of
95.IR sort\ \-b ;
96with
97.BR \-t ,
98the sequence is that of a plain sort.
99.PP
100The conventions of
101.I join, sort, comm, uniq, look
102and
103.IR awk (1)
104are wildly incongruous.