204 lines
4.4 KiB
Groff
204 lines
4.4 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g1.join @(#)join 41.8 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} join 1 "Directory and File Management Utilities" "\&"
|
|
.if \nX=1 .ds x} join 1 "Directory and File Management Utilities"
|
|
.if \nX=2 .ds x} join 1 "" "\&"
|
|
.if \nX=3 .ds x} join "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4join\f1 \- relational database operator
|
|
.SH SYNOPSIS
|
|
\f4join\f1
|
|
[
|
|
.I \-a n | \-v n
|
|
]
|
|
[
|
|
.I \-e s
|
|
]
|
|
[
|
|
.I \-o list
|
|
]
|
|
[
|
|
.I \-t c
|
|
]
|
|
[
|
|
.I \-1 field
|
|
]
|
|
[
|
|
.I \-2 field
|
|
]
|
|
.I file1
|
|
.I file2
|
|
|
|
.SH DESCRIPTION
|
|
\f4join\fP
|
|
forms, on the standard output,
|
|
a join
|
|
of the two relations specified by the lines of
|
|
.I file1\^
|
|
and
|
|
.IR file2 .
|
|
If
|
|
.I file1\^
|
|
is \f4\-\fP, the standard input is used.
|
|
.I file1\^
|
|
and
|
|
.I file2\^
|
|
must be sorted in increasing code set collating
|
|
sequence on the fields
|
|
on which they are to be joined,
|
|
normally the first in each line [see \f4sort\fP(1)].
|
|
\f4join\f1 processes supplementary code set characters in files,
|
|
and recognizes supplementary code set characters given
|
|
to the \f4\-e\f1 and \f4\-t\fP options (see below)
|
|
according to the locale specified in the \f4LC_CTYPE\fP
|
|
environment variable [see \f4LANG\fP on \f4environ\fP(5)].
|
|
.PP
|
|
There is one line in the output
|
|
for each pair of lines in
|
|
.I file1\^
|
|
and
|
|
.I file2\^
|
|
that have identical join fields.
|
|
The output line normally consists of the common field,
|
|
then the rest of the line from
|
|
.IR file1 ,
|
|
then the rest of the line from
|
|
.IR file2 .
|
|
.PP
|
|
The default input field separators are blank, tab, or new-line.
|
|
In this case, multiple separators count as one field separator, and
|
|
leading separators are ignored.
|
|
The default output field separator is a blank.
|
|
.PP
|
|
Some of the options below use the argument
|
|
.IR n .
|
|
This argument should be a
|
|
\f41\f1
|
|
or a
|
|
\f42\f1
|
|
referring to either
|
|
.I file1
|
|
or
|
|
.IR file2 ,
|
|
respectively.
|
|
The following options are recognized:
|
|
.TP \w'\f4\-o\fP\ \f2list\fP\ \ 'u
|
|
\f4\-a\f2 n\f1
|
|
In addition to the normal output,
|
|
produce a line for each unpairable line in file
|
|
.IR n ,
|
|
where
|
|
.I n\^
|
|
is 1 or 2.
|
|
.TP
|
|
\f4\-e\f2 s\f1
|
|
Replace empty output fields with string
|
|
.IR s .
|
|
\f2s\f1 may contain supplementary code set characters.
|
|
.TP
|
|
\f4\-o\f2 list\f1
|
|
Each output line includes the fields specified in
|
|
.IR list ,
|
|
each element of which has the form
|
|
\f2n\f4.\f2m\^\f1,\f1
|
|
where
|
|
.I n\^
|
|
is a file number and
|
|
.I m\^
|
|
is a field number.
|
|
The common field is not printed
|
|
unless specifically requested.
|
|
The list\f1 must be a single command line argument.
|
|
.TP
|
|
\f4\-t\f2 c\f1
|
|
Use character
|
|
.I c\^
|
|
as a separator (tab character).
|
|
Every appearance of
|
|
.I c\^
|
|
in a line is significant.
|
|
The character
|
|
.I c\^
|
|
is used as the field separator for both
|
|
input and output.
|
|
\f2c\f1 may be a supplementary code set character.
|
|
.TP
|
|
\f4\-v\f2 n\f1
|
|
Instead of the default output, produce a line only for each
|
|
unpairable line in n\f1, where n\f1 is 1 or 2. If both
|
|
\f4\-v\f2 1\f1 and \f4\-v\f2 2\f1 are specified, all unpairable
|
|
lines will be output.
|
|
.TP
|
|
\f4\-1\f2 field\f1
|
|
Join the field\f1th field of file 1.
|
|
Fields are decimal integers starting with 1.
|
|
.TP
|
|
\f4\-2\f2 field\f1
|
|
Join the field\f1th field of file 2.
|
|
Fields are decimal integers starting with 1.
|
|
.PP
|
|
The following options are obsoleted:
|
|
.TP
|
|
\f4\-j\f2 field\f1
|
|
Equivalent to: \f4\-1 field\f1 \f4\-2 field\f1.
|
|
.TP
|
|
\f4\-j\f21 field\f1
|
|
Equivalent to: \f4\-1 field\f1.
|
|
.TP
|
|
\f4\-j\f22 field\f1
|
|
Equivalent to: \f4\-2 field\f1.
|
|
.SH EXAMPLE
|
|
The following command line will join
|
|
the password file and the group file,
|
|
matching on the numeric group ID, and outputting
|
|
the login name, the group name, and the login
|
|
directory.
|
|
It is assumed that the files have been sorted
|
|
in code set collating sequence on
|
|
the group ID fields.
|
|
.PP
|
|
.RS 2n
|
|
.ft 4
|
|
join \-1 4 \-2 3 \-o 1.1,2.1,1.6 \-t \: /etc/passwd /etc/group
|
|
.ft 1
|
|
.RE
|
|
.SH FILES
|
|
.TP
|
|
\f4/usr/lib/locale/\f2locale\f4/LC_MESSAGES/uxdfm\f1
|
|
language-specific message file [See \f4LANG\fP on \f4environ\f1(5).]
|
|
.SH "SEE ALSO"
|
|
\f4awk\fP(1), \f4comm\fP(1), \f4sort\fP(1), \f4uniq\fP(1)
|
|
.SH NOTES
|
|
With default field separation,
|
|
the collating sequence is that of
|
|
\f4sort \-b\f1;
|
|
with
|
|
\f4\-t\f1,
|
|
the sequence is that of a plain sort.
|
|
.PP
|
|
The conventions of the
|
|
\f4join\fP,
|
|
\f4sort\fP,
|
|
\f4comm\fP,
|
|
\f4uniq\fP,
|
|
and
|
|
\f4awk\fP
|
|
commands are wildly incongruous.
|
|
.P
|
|
As an obsolescent feature, mutiple arguments can be specified for
|
|
\f4\-o\f1 option. At that time, filenames that are numeric may cause
|
|
conflict when the \f4\-o\f1 option is used just before listing
|
|
filenames.
|
|
|
|
.\" @(#)join.1 6.3 of 9/2/83
|
|
.Ee
|
|
|
|
|
|
|
|
|
|
|