1JOIN(1) User Commands JOIN(1)
2
3
4
6 join - join lines of two files on a common field
7
9 join [OPTION]... FILE1 FILE2
10
12 For each pair of input lines with identical join fields, write a line
13 to standard output. The default join field is the first, delimited by
14 blanks.
15
16 When FILE1 or FILE2 (not both) is -, read standard input.
17
18 -a FILENUM
19 also print unpairable lines from file FILENUM, where FILENUM is
20 1 or 2, corresponding to FILE1 or FILE2
21
22 -e STRING
23 replace missing (empty) input fields with STRING; I.e., missing
24 fields specified with '-12jo' options
25
26 -i, --ignore-case
27 ignore differences in case when comparing fields
28
29 -j FIELD
30 equivalent to '-1 FIELD -2 FIELD'
31
32 -o FORMAT
33 obey FORMAT while constructing output line
34
35 -t CHAR
36 use CHAR as input and output field separator
37
38 -v FILENUM
39 like -a FILENUM, but suppress joined output lines
40
41 -1 FIELD
42 join on this FIELD of file 1
43
44 -2 FIELD
45 join on this FIELD of file 2
46
47 --check-order
48 check that the input is correctly sorted, even if all input
49 lines are pairable
50
51 --nocheck-order
52 do not check that the input is correctly sorted
53
54 --header
55 treat the first line in each file as field headers, print them
56 without trying to pair them
57
58 -z, --zero-terminated
59 line delimiter is NUL, not newline
60
61 --help display this help and exit
62
63 --version
64 output version information and exit
65
66 Unless -t CHAR is given, leading blanks separate fields and are ig‐
67 nored, else fields are separated by CHAR. Any FIELD is a field number
68 counted from 1. FORMAT is one or more comma or blank separated speci‐
69 fications, each being 'FILENUM.FIELD' or '0'. Default FORMAT outputs
70 the join field, the remaining fields from FILE1, the remaining fields
71 from FILE2, all separated by CHAR. If FORMAT is the keyword 'auto',
72 then the first line of each file determines the number of fields output
73 for each line.
74
75 Important: FILE1 and FILE2 must be sorted on the join fields. E.g.,
76 use "sort -k 1b,1" if 'join' has no options, or use "join -t ''" if
77 'sort' has no options. Note, comparisons honor the rules specified by
78 'LC_COLLATE'. If the input is not sorted and some lines cannot be
79 joined, a warning message will be given.
80
82 Written by Mike Haertel.
83
85 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
86 Report any translation bugs to <https://translationproject.org/team/>
87
89 Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU
90 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
91 This is free software: you are free to change and redistribute it.
92 There is NO WARRANTY, to the extent permitted by law.
93
95 comm(1), uniq(1)
96
97 Full documentation <https://www.gnu.org/software/coreutils/join>
98 or available locally via: info '(coreutils) join invocation'
99
100
101
102GNU coreutils 9.1 January 2023 JOIN(1)