Debian Codegraph @

man/join-dctrl.1

raw
1 .TH join\-dctrl 1
2 \" Copyright © 2007 Antti-Juhani Kaijanaho <[email protected]>
3 \" This program is free software; you can redistribute it and/or modify
4 \" it under the terms of the GNU General Public License as published by
5 \" the Free Software Foundation; either version 2 of the License, or
6 \" (at your option) any later version.
7 \"
8 \" This program is distributed in the hope that it will be useful,
9 \" but WITHOUT ANY WARRANTY; without even the implied warranty of
10 \" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 \" GNU General Public License for more details.
12 \"
13 \" You should have received a copy of the GNU General Public License
14 \" along with this program; see the file COPYING. If not, write to
15 \" the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 \" Boston, MA 02111-1307, USA.
17 .SH NAME
18 join\-dctrl \- perform relational join on data in dctrl format
19 .SH SYNOPSIS
20 .B join\-dctrl
21 [
22 .I options
23 ]
24 .I filename
25 .I filename
26 .sp
27 .B join\-dctrl
28 .B \-\-version
29 .sp
30 .B join\-dctrl
31 .B \-\-help
32 .SH DESCRIPTION
33 .B join\-dctrl
34 performs a relational join operation on data given to it in Debian control
35 file format.
36 .PP
37 A
38 .I "join field"
39 must be specified using either the switches
40 .B \-1
41 and
42 .B \-2
43 or the switch
44 .BR \-j .
45 .
46 Conceptually, the program creates all ordered pairs of records
47 that can be formed by having a record from the first file as the first
48 member of the pair and having a record from the second file as the
49 second member of the pair; and then it deletes all such pairs where
50 the join fields are not equal.
51 .
52 Effectively, each of the input files is treated as a relational database table.
53 .PP
54 Every input file must be in ascending order on its join field; this
55 allows the program to work fast.
56 .
57 The
58 .BR sort\-dctrl (1)
59 program can be used to make it so.
60 .SH OPTIONS
61 .IP "\fB\-1 \fIfield\fR, \fB\-\-1st\-join\-field=\fIfield"
62 Specify the join
63 .I field
64 of the first input file.
65 .IP "\fB\-2 \fIfield\fR, \fB\-\-2nd\-join\-field=\fIfield"
66 Specify the join
67 .I field
68 of the second input file.
69 .IP "\fB\-j \fIfield\fR, \fB\-\-join\-field=\fIfield"
70 Specify a common join
71 .I field
72 for all files.
73 .IP "\fB\-a \fIfileno\fR, \fB\-\-unpairable\-from=\fIfileno"
74 Specify that unmatched paragraphs from the first (if
75 .B 1
76 is given) or
77 the second (if
78 .B 2
79 is given) file are printed.
80 .IP "\fB\-o \fIfieldspec\fR, \fB\-\-output\-fields=\fIfieldspec"
81 Specify which fields are included in the output.
82 .
83 Fields are separated by commas (more than one
84 .B \-o
85 option can be used,
86 too).
87 .
88 Each field is specified in the format
89 .IB fileno . field
90 in which
91 .I fileno
92 is the ordinal number of the input file from which the field is drawn
93 (either
94 .BR 1 " or " 2 ),
95 and
96 .I field
97 gives the name of the field to use.
98 .
99 As a special case, simple
100 .B 0
101 can be used instead of
102 .IB fileno . field
103 to refer to the common value of the join fields.
104 .IP
105 The name of the field (not including the file number) is used in the
106 output as the name of the field.
107 .
108 However, a different name for output purposes can be specified by
109 suffixing the field specification by a colon and the preferred visible
110 name.
111 .IP
112 For example, the option
113 .B \-o 0,1.Version:Old-Version,2.Version
114 specifies that the first field in any output record should be the join field,
115 the second field should be
116 .B Old-Version
117 drawing its data from the
118 .B Version
119 field of the first input file, and the third field should be
120 .B Version
121 drawing its data from the field with the same name in the second input
122 file, and these are the only fields in an output record.
123 .IP
124 If no
125 .B \-o
126 option is given, all fields of all the records being joined
127 are included in the output.
128 .IP "\fB\-l \fIlevel\fR, \fB\-\-errorlevel=\fIlevel"
129 Set log level to
130 .IR level .
131 .I level
132 is one of
133 .BR fatal ", " important ", " informational " and " debug ,
134 but the last may not be available,
135 depending on the compile-time options. These categories are given
136 here in order; every message that is emitted when
137 .B fatal
138 is in effect, will be emitted in the
139 .B important
140 error level, and so on. The default is
141 .BR important .
142 .TP
143 .BR \-V ", " \-\-version
144 Print out version information.
145 .TP
146 .BR \-C ", " \-\-copying
147 Print out the copyright license. This produces much output; be sure
148 to redirect or pipe it somewhere (such as your favourite pager).
149 .TP
150 .BR \-h ", " \-\-help
151 Print out a help summary.
152 .SH OPERANDS
153 .B join\-dctrl
154 will treat each file named on the command line as a relational
155 database table.
156 .
157 A file called
158 .B \-
159 represents the program's standard input stream.
160 .
161 Currently, exactly two files must be named.
162 .SH STDIN
163 The standard input stream may be used as input as specified above in
164 the
165 .B OPERANDS
166 section.
167 .SH "INPUT FILES"
168 All input to
169 .B join\-dctrl
170 is in the format of a Debian control file.
171 .PP
172 A Debian control (dctrl) file is a semistructured single-table
173 database stored in a machine-parseable text file.
174 .
175 Such a database consists of a set of records; each record is a mapping
176 from field names to field content.
177 .
178 Textually, records are separated by empty lines, while each field is
179 encoded as one or more nonempty lines inside a record.
180 .
181 A field starts with its name, followed by a colon, followed by the
182 field content.
183 .
184 The colon must reside on the first line of the field, and the first
185 line must start with no whitespace.
186 .
187 Subsequent lines, in contrast, always start with linear whitespace
188 (one or more space or tab characters).
189 .PP
190 Each input file must be in the ascending order of its join field.
191 .SH "ENVIRONMENT VARIABLES"
192 The standard locale environment, specifically its character set
193 setting, affects the interpretation of input and output as character
194 streams.
195 .SH "ASYNCHRONOUS EVENTS"
196 Standard UNIX signals have their usual meaning.
197 .SH STDOUT
198 All output is sent to the standard output stream.
199 .
200 The output is in the format of a Debian control file, described above
201 in the
202 .B "INPUT FILES"
203 section.
204 .
205 The output will be in the ascending order of the join field, if that
206 field is included in the output.
207 .SH "OUTPUT FILES"
208 There are no output files.
209 .SH "EXIT STATUS"
210 This utility exits with
211 .B 0
212 when successful. It uses a nonzero exit
213 code inconsistently when an error is noticed (this is a bug).
214 .SH "CONSEQUENCES OF ERRORS"
215 In case of errors in the input, the output will be partially or
216 completely garbage. In case of errors in invocation, the program will
217 refuse to function.
218 .SH "EXAMPLES"
219 Suppose that a file containing data about binary packages for the
220 AMD64 architecture contained in the Debian squeeze (6.0) release, section
221 .BR main ,
222 is in the current directory and named
223 .IR Packages .
224 .
225 Suppose that we are currently on a Debian system.
226 .
227 Suppose further that the current directory does not contain files named
228 .IR stat " and " pkg .
229 .
230 The following commands gives, for each package currently installed and
231 available in Debian squeeze (6.0), its currently installed version (as
232 Old-Version) and the version in squeeze (as New-Version):
233 .nf
234 $ sort-dctrl -kPackage /var/lib/dpkg/status > stat
235 $ sort-dctrl -kPackage Packages > pkg
236 $ join-dctrl -j Package \\
237 -o 0,1.Version:Old-Version,2.Version:New-Version \\
238 stat pkg
239 .fi
240 .SH AUTHOR
241 The
242 .B join\-dctrl
243 program and this manual page were written by Antti-Juhani Kaijanaho.
244 .SH "SEE ALSO"
245 .BR grep\-dctrl (1),
246 .BR sort\-dctrl (1),
247 .BR tbl\-dctrl (1)
248