maux
Star on GitHub Buy me a coffee

Manual / join

join(1)

JOIN(1) General Commands Manual JOIN(1)

join - relational join of two sorted files on a common field

join [ -a n | -v n ] [ -e string ] [ -o list ] [ -t char ] [ -1 n ] [ -2 n ] file1 file2

Join reads file1 and file2, each already sorted on its own join field (field 1 by default, -1 and -2 select a different field per side), and writes one line per matching pair: the join field, then file1's other fields, then file2's other fields. It does not sort and does not check.

The default field separator is a run of blanks, leading blanks ignored; -t char makes char the separator on both input and output, and every field it bounds — an empty one included — counts. -a n adds n's own unpaired lines to the output; -v n prints only n's unpaired lines, in place of the normal output. -o list is a comma-separated list of m.n field selectors (or the bare digit 0 for the join field) choosing and ordering the output fields; an item naming a side that has no line for the current record prints empty, replaced by -e string when given (the XCU/GNU rule: applied only through -o; BSD's own -e differs). (-1/-2) field numbers and -o selectors are single digits in this build.

A - names standard input for either operand (not both at once).

/usr/man/JOIN this page

Exit status is 0 on success; 1 if a file could not be opened; 2 on a usage error.

None known.

September 15, 2026 maux