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