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