LinuxCommandLibrary

join-dctrl

Join Debian control files

SYNOPSIS

join-dctrl [options...] [file1 [file2]]

PARAMETERS

-k FIELD, --key=FIELD
    Key field in first file (default: Package)

-j FIELD, --join-key=FIELD
    Key field in second file (default: same as -k)

-o LIST, --output=LIST
    Comma/space-separated output fields from both files (e.g. Package,Version,Installed-Size)

-f CHAR, --fs=CHAR
    Field separator (default: :)

-S CHAR, --rs=CHAR
    Record separator in output (default: newline; empty line for paragraphs)

-s CHAR, --ms=CHAR
    Separator between merged values (default: space)

-m, --merge
    Merge multi-occurrence fields instead of duplicating

-i, --ignore-case
    Case-insensitive key matching

-q, --quoted
    Quote all field values in output

-h, --help
    Display usage summary

-V, --version
    Print version information

DESCRIPTION

join-dctrl is a utility from the dctrl-tools package for merging records from two Debian control files, such as /var/lib/dpkg/status and /var/lib/apt/lists/*_Packages. It functions like the Unix join(1) command but is tailored for the paragraph-based format of Debian package metadata, where each record is a block of colon-separated key-value pairs ended by an empty line.

Specify key fields for matching records between the first (left) and second (right) files. Output merged records with selected fields, customizable separators, and options for handling multi-valued fields or case-insensitivity. Ideal for complex queries on package databases, like combining installed status with repository data.

Without files, reads from stdin; supports piping. Outputs in Debian control format by default, preserving structure for further processing with tools like grep-dctrl.

CAVEATS

Expects strict Debian control format; malformed input may cause incomplete joins. Output fields must exist in input files or join fails. Large files can be memory-intensive without streaming optimizations.

EXAMPLES

join-dctrl /var/lib/dpkg/status /tmp/Packages -k Package -o Package,Version,Installed-Size
Joins installed packages with repo data on Package field.

echo 'Package: foo ' | join-dctrl - /var/lib/dpkg/status -o Status
Pipes single record to check status.

HISTORY

Developed by Frank Lichtenheld in 2004 as part of dctrl-tools for Debian. Evolved to support advanced merging for package management tools; current in Debian 12+.

SEE ALSO

grep-dctrl(1), show-dctrl(1), dpkg-query(1), dctrl(5)

Copied to clipboard