SORT-DCTRL(1) | Debian user's manual | SORT-DCTRL(1) |
sort-dctrl - sort Debian control files
sort-dctrl [options] [ file ... ]
sort-dctrl --copying | --help | --version | -ChV
The sort-dctrl program sorts Debian control files according to specified criteria.
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).
The sort-dctrl program recognizes two field types: string fields and version fields. Version fields act also as numeric fields. String fields are compared according to strict lexicographical octet-by-octet comparison, after ignoring any initial whitespace after the colon. Version fields are parsed and compared as Debian version numbers. When comparing version numbers, if a field content does not in fact conform to the version number syntax, it compares less than any field content that does conform, and equal to any other nonconforming field content. The sort-dctrl program assumes all fields are string fields unless told otherwise.
You can specify arbitrary number of keys for sorting, using the -k option. The keys are interpreted in a descending order of priority: the first key specified is primary, the second key specified is secondary, and so on. If two records compare equal under the primary key, then they are compared under the secondary key, and so on. If no keys are specified, a default key is assumed (the "Package" field with no modifiers).
Here are some sample invocations of the program:
The program and this manual page were written by Antti-Juhani Kaijanaho <ajk@debian.org>.
Debian Policy Manual. Published as the Debian package debian-policy. Also available in the Debian website.
2005-06-08 | Debian Project |