join-dctrl(1) | General Commands Manual | join-dctrl(1) |
join-dctrl - perform relational join on data in dctrl format
join-dctrl [ options ] filename filename
join-dctrl --version
join-dctrl --help
join-dctrl performs a relational join operation on data given to it in Debian control file format.
A join field must be specified using either the switches -1 and -2 or the switch -j. 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.
Every input file must be in ascending order on its join field; this allows the program to work fast. The sort-dctrl(1) program can be used to make it so.
join-dctrl will treat each file named on the command line as a relational database table. A file called - represents the program's standard input stream. Currently, exactly two files must be named.
The standard input stream may be used as input as specified above in the OPERANDS section.
All input to join-dctrl is in the format of a Debian control file.
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).
Each input file must be in the ascending order of its join field.
The standard locale environment, specifically its character set setting, affects the interpretation of input and output as character streams.
Standard UNIX signals have their usual meaning.
All output is sent to the standard output stream. The output is in the format of a Debian control file, described above in the INPUT FILES section. The output will be in the ascending order of the join field, if that field is included in the output.
There are no output files.
This utility exits with 0 when successful. It uses a nonzero exit code inconsistently when an error is noticed (this is a bug).
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.
Suppose that a file containing data about binary packages for the AMD64 architecture contained in the Debian squeeze (6.0) release, section main, is in the current directory and named Packages. Suppose that we are currently on a Debian system. Suppose further that the current directory does not contain files named stat and pkg. 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):
$ sort-dctrl -kPackage /var/lib/dpkg/status > stat $ sort-dctrl -kPackage Packages > pkg $ join-dctrl -j Package \
-o 0,1.Version:Old-Version,2.Version:New-Version \
stat pkg
The join-dctrl program and this manual page were written by Antti-Juhani Kaijanaho.