man-pages/man1/join-dctrl.1.html
2021-03-31 01:06:50 +01:00

343 lines
8.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of join-dctrl</TITLE>
</HEAD><BODY>
<H1>join-dctrl</H1>
Section: User Commands (1)<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
join-dctrl - perform relational join on data in dctrl format
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>join-dctrl</B>
[
<I>options</I>
]
<I>filename</I>
<I>filename</I>
<P>
<B>join-dctrl</B>
<B>--version</B>
<P>
<B>join-dctrl</B>
<B>--help</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>join-dctrl</B>
performs a relational join operation on data given to it in Debian control
file format.
<P>
A
<I>join field</I>
must be specified using either the switches
<B>-1</B>
and
<B>-2</B>
or the switch
<B>-j</B>.
Conceptually, the program creates all ordered pairs of records
that can be formed by having a record from the first file as the first
member of the pair and having a record from the second file as the
second member of the pair; and then it deletes all such pairs where
the join fields are not equal.
Effectively, each of the input files is treated as a relational database table.
<P>
Every input file must be in ascending order on its join field; this
allows the program to work fast.
The
<B><A HREF="/cgi-bin/man/man2html?1+sort-dctrl">sort-dctrl</A></B>(1)
program can be used to make it so.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-1 </B><I>field</I>, <B>--1st-join-field=</B><I>field<DD>
Specify the join
field</I>
of the first input file.
<DT id="2"><B>-2 </B><I>field</I>, <B>--2nd-join-field=</B><I>field<DD>
Specify the join
field</I>
of the second input file.
<DT id="3"><B>-j </B><I>field</I>, <B>--join-field=</B><I>field<DD>
Specify a common join
field</I>
for all files.
<DT id="4"><B>-a </B><I>fileno</I>, <B>--unpairable-from=</B><I>fileno<DD>
Specify that unmatched paragraphs from the first (if
</I><B>1</B>
is given) or
the second (if
<B>2</B>
is given) file are printed.
<DT id="5"><B>-o </B><I>fieldspec</I>, <B>--output-fields=</B><I>fieldspec<DD>
Specify which fields are included in the output.
Fields are separated by commas (more than one
</I><B>-o</B>
option can be used,
too).
Each field is specified in the format
<I>fileno</I><B>.</B><I>field</I>
in which
<I>fileno</I>
is the ordinal number of the input file from which the field is drawn
(either
<B>1</B> or <B>2</B>),
and
<I>field</I>
gives the name of the field to use.
As a special case, simple
<B>0</B>
can be used instead of
<I>fileno</I><B>.</B><I>field</I>
to refer to the common value of the join fields.
<DT id="6"><DD>
The name of the field (not including the file number) is used in the
output as the name of the field.
However, a different name for output purposes can be specified by
suffixing the field specification by a colon and the preferred visible
name.
<DT id="7"><DD>
For example, the option
<B>-o 0,1.Version:Old-Version,2.Version</B>
specifies that the first field in any output record should be the join field,
the second field should be
<B>Old-Version</B>
drawing its data from the
<B>Version</B>
field of the first input file, and the third field should be
<B>Version</B>
drawing its data from the field with the same name in the second input
file, and these are the only fields in an output record.
<DT id="8"><DD>
If no
<B>-o</B>
option is given, all fields of all the records being joined
are included in the output.
<DT id="9"><B>-l </B><I>level</I>, <B>--errorlevel=</B><I>level<DD>
Set log level to
level</I>.
<I>level</I>
is one of
<B>fatal</B>, <B>important</B>, <B>informational</B> and <B>debug</B>,
but the last may not be available,
depending on the compile-time options. These categories are given
here in order; every message that is emitted when
<B>fatal</B>
is in effect, will be emitted in the
<B>important</B>
error level, and so on. The default is
<B>important</B>.
<DT id="10"><B>-V</B>, <B>--version</B>
<DD>
Print out version information.
<DT id="11"><B>-C</B>, <B>--copying</B>
<DD>
Print out the copyright license. This produces much output; be sure
to redirect or pipe it somewhere (such as your favourite pager).
<DT id="12"><B>-h</B>, <B>--help</B>
<DD>
Print out a help summary.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>OPERANDS</H2>
<B>join-dctrl</B>
will treat each file named on the command line as a relational
database table.
A file called
<B>-</B>
represents the program's standard input stream.
Currently, exactly two files must be named.
<A NAME="lbAG">&nbsp;</A>
<H2>STDIN</H2>
The standard input stream may be used as input as specified above in
the
<B>OPERANDS</B>
section.
<A NAME="lbAH">&nbsp;</A>
<H2>INPUT FILES</H2>
All input to
<B>join-dctrl</B>
is in the format of a Debian control file.
<P>
A Debian control (dctrl) file is a semistructured single-table
database stored in a machine-parseable text file.
Such a database consists of a set of records; each record is a mapping
from field names to field content.
Textually, records are separated by empty lines, while each field is
encoded as one or more nonempty lines inside a record.
A field starts with its name, followed by a colon, followed by the
field content.
The colon must reside on the first line of the field, and the first
line must start with no whitespace.
Subsequent lines, in contrast, always start with linear whitespace
(one or more space or tab characters).
<P>
Each input file must be in the ascending order of its join field.
<A NAME="lbAI">&nbsp;</A>
<H2>ENVIRONMENT VARIABLES</H2>
The standard locale environment, specifically its character set
setting, affects the interpretation of input and output as character
streams.
<A NAME="lbAJ">&nbsp;</A>
<H2>ASYNCHRONOUS EVENTS</H2>
Standard UNIX signals have their usual meaning.
<A NAME="lbAK">&nbsp;</A>
<H2>STDOUT</H2>
All output is sent to the standard output stream.
The output is in the format of a Debian control file, described above
in the
<B>INPUT FILES</B>
section.
The output will be in the ascending order of the join field, if that
field is included in the output.
<A NAME="lbAL">&nbsp;</A>
<H2>OUTPUT FILES</H2>
There are no output files.
<A NAME="lbAM">&nbsp;</A>
<H2>EXIT STATUS</H2>
This utility exits with
<B>0</B>
when successful. It uses a nonzero exit
code inconsistently when an error is noticed (this is a bug).
<A NAME="lbAN">&nbsp;</A>
<H2>CONSEQUENCES OF ERRORS</H2>
In case of errors in the input, the output will be partially or
completely garbage. In case of errors in invocation, the program will
refuse to function.
<A NAME="lbAO">&nbsp;</A>
<H2>EXAMPLES</H2>
Suppose that a file containing data about binary packages for the
AMD64 architecture contained in the Debian squeeze (6.0) release, section
<B>main</B>,
is in the current directory and named
<I>Packages</I>.
Suppose that we are currently on a Debian system.
Suppose further that the current directory does not contain files named
<I>stat</I> and <I>pkg</I>.
The following commands gives, for each package currently installed and
available in Debian squeeze (6.0), its currently installed version (as
Old-Version) and the version in squeeze (as New-Version):
<PRE>
$ sort-dctrl -kPackage /var/lib/dpkg/status &gt; stat
$ sort-dctrl -kPackage Packages &gt; pkg
$ join-dctrl -j Package \
-o 0,1.Version:Old-Version,2.Version:New-Version \
stat pkg
</PRE>
<A NAME="lbAP">&nbsp;</A>
<H2>AUTHOR</H2>
The
<B>join-dctrl</B>
program and this manual page were written by Antti-Juhani Kaijanaho.
<A NAME="lbAQ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+grep-dctrl">grep-dctrl</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+sort-dctrl">sort-dctrl</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+tbl-dctrl">tbl-dctrl</A></B>(1)
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="13"><A HREF="#lbAB">NAME</A><DD>
<DT id="14"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="15"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="16"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="17"><A HREF="#lbAF">OPERANDS</A><DD>
<DT id="18"><A HREF="#lbAG">STDIN</A><DD>
<DT id="19"><A HREF="#lbAH">INPUT FILES</A><DD>
<DT id="20"><A HREF="#lbAI">ENVIRONMENT VARIABLES</A><DD>
<DT id="21"><A HREF="#lbAJ">ASYNCHRONOUS EVENTS</A><DD>
<DT id="22"><A HREF="#lbAK">STDOUT</A><DD>
<DT id="23"><A HREF="#lbAL">OUTPUT FILES</A><DD>
<DT id="24"><A HREF="#lbAM">EXIT STATUS</A><DD>
<DT id="25"><A HREF="#lbAN">CONSEQUENCES OF ERRORS</A><DD>
<DT id="26"><A HREF="#lbAO">EXAMPLES</A><DD>
<DT id="27"><A HREF="#lbAP">AUTHOR</A><DD>
<DT id="28"><A HREF="#lbAQ">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:17 GMT, March 31, 2021
</BODY>
</HTML>