j

join(1)

join(1)

NAME

join - relational database operator

SYNOPSIS

join [ options ] ®le1 ®le2

DESCRIPTION

join forms, on the standard output, a join of the two relations speci®ed by the lines of ®le1 and ®le2. If ®le1 or ®le2 is -, the standard input is used.

®le1 and ®le2 must be sorted in increasing collating sequence (see Environment Variables below) on the ®elds on which they are to be joined; normally the ®rst in each line.

The output contains one line for each pair of lines in ®le1 and ®le2 that have identical join ®elds. The output line normally consists of the common ®eld followed by the rest of the line from ®le1, then the rest of the line from ®le2.

The default input ®eld separators are space, tab, or new-line. In this case, multiple separators count as one ®eld separator, and leading separators are ignored. The default output ®eld separator is a space.

Some of the below options use the argument n. This argument should be a 1 or a 2 referring to either ®le1 or ®le2, respectively.

Options

-an In addition to the normal output, produce a line for each unpairable line in ®le n, where n is 1 or 2.

-es Replace empty output ®elds by string s.

-jm Join on ®eld m of both ®les. The argument m must be delimited by space characters. This option and the following two are provided for backward compatibility. Use of the -1and -2options ( see below ) is recommended for portability.

-j1m Join on ®eld m of ®le1.

-j2m Join on ®eld m of ®le2.

-olist Each output line comprises the ®elds speci®ed in list, each element of which has the form n.m, where n is a ®le number and m is a ®eld number. The common ®eld is not printed unless speci®cally requested.

-tc Use character c as a separator (tab character). Every appearance of c in a line is signi®cant. The character c is used as the ®eld separator for both input and output.

-vfile_number

Instead of the default output, produce a line only for each unpairable line in ®le_number, where ®le_number is 1 or 2.

-1f Join on ®eld f of ®le 1. Fields are numbered starting with 1.

-2f Join on ®eld f of ®le 2. Fields are numbered starting with 1.

EXTERNAL INFLUENCES

Environment Variables

LC_COLLATE determines the collating sequence join expects from input ®les.

LC_CTYPE determines the alternative blank character as an input ®eld separator, and the interpretation of data within ®les as single and/or multi-byte characters. LC_CTYPE also determines whether the separator de®ned through the -toption is a single- or multi-byte character.

If LC_COLLATE or LC_CTYPE is not speci®ed in the environment or is set to the empty string, the value of LANG is used as a default for each unspeci®ed or empty variable. If LANG is not speci®ed or is set to the empty string, a default of ``C'' (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, join behaves as if all internationalization variables are set to ``C'' (see environ(5)).

International Code Set Support

Single- and multi-byte character code sets are supported with the exception that multi-byte-character ®le names are not supported.

Section 1364

− 1 −

HP-UX Release 11i: December 2000