File: join.1

package info (click to toggle)
textutils 1.22-2.4
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 6,480 kB
  • ctags: 2,942
  • sloc: ansic: 31,755; sh: 8,186; perl: 811; makefile: 640; sed: 93
file content (105 lines) | stat: -rw-r--r-- 2,726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.TH JOIN 1 "GNU Text Utilities" "FSF" \" -*- nroff -*-
.SH NAME
join \- join lines of two files on a common field
.SH SYNOPSIS
.B join
[\-a 1|2] [\-v 1|2] [\-e empty-string] [\-o field-list...] [\-t char]
[\-j[1|2] field] [\-1 field] [\-2 field] file1 file2
.br
.B join
{\-\-help,\-\-version}
.SH DESCRIPTION
This documentation is no longer being maintained and may be inaccurate
or incomplete.  The Texinfo documentation is now the authoritative source.
.PP
This manual page
documents the GNU version of
.BR join .
.B join
prints to the standard output a line for each pair of input lines, one
each from
.I file1
and
.IR file2 ,
that have identical join fields.  Either filename (but not both) can
be `\-', meaning the standard input.
.I file1
and
.I file2
should be already sorted in increasing order (not numerically) on the
join fields; unless the
.I \-t
option is given, they should be sorted ignoring blanks at the start of
the line, as
.B sort
does when given the
.I \-b
option.
.PP
The defaults are: the join field is the first field in each line;
fields in the input are separated by one or more blanks, with leading
blanks on the line ignored; fields in the output are separated by a
space; each output line consists of the join field, the remaining
fields from
.IR file1 ,
then the remaining fields from
.IR file2 .
.SS OPTIONS
.TP
.I "\-a file-number"
Print a line for each unpairable line in file
.I file-number
(either 1 or 2), in addition to the normal output.
.TP
.I "\-e string"
Replace empty output fields (those that are missing in the input) with
.IR string .
.TP
.I "\-1, \-j1 field"
Join on field
.I field
(a positive integer) of file 1.
.TP
.I "\-2, \-j2 field"
Join on field
.I field
(a positive integer) of file 2.
.TP
.I "\-j field"
Equivalent to
.IR "\-1 field \-2 field" .
.TP
.I "\-o field-list..."
Construct each output line according to the format in
.IR field-list .
Each element in
.I field-list
consists of a file number (either 1 or 2), a period, and a field
number (a positive integer).  The elements in the list are separated
by commas or blanks.  Multiple
.I field-list
arguments can be given after a single
.I \-o
option; the values of all lists given with
.I \-o
are concatenated together.
.TP
.I "\-t char"
Use character
.I char
as the input and output field separator.
.TP
.I "\-v file-number"
Print a line for each unpairable line in file
.I file-number
(either 1 or 2), instead of the normal output.
.PP
In addition, when GNU
.B join
is invoked with exactly one argument, the following options are recognized:
.TP
.I "\-\-help"
Print a usage message on standard output and exit successfully.
.TP
.I "\-\-version"
Print version information on standard output then exit successfully.