| 1 |
.TH SORT-DCTRL 1 2005-06-08 "Debian Project" "Debian user's manual" |
| 2 |
\" Copyright (C) 2005 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 |
sort\-dctrl \- sort Debian control files |
| 19 |
.SH SYNOPSIS |
| 20 |
.B sort\-dctrl |
| 21 |
[options] |
| 22 |
[ |
| 23 |
.IR file " ..." |
| 24 |
] |
| 25 |
.sp |
| 26 |
.B sort\-dctrl |
| 27 |
\-\-copying | \-\-help | \-\-version | \-ChV |
| 28 |
.SH DESCRIPTION |
| 29 |
The |
| 30 |
.B sort\-dctrl |
| 31 |
program sorts Debian control files according to specified criteria. |
| 32 |
.PP |
| 33 |
A Debian control (dctrl) file is a semistructured single-table |
| 34 |
database stored in a machine-parseable text file. |
| 35 |
. |
| 36 |
Such a database |
| 37 |
consists of a set of records; each record is a mapping from field |
| 38 |
names to field content. |
| 39 |
. |
| 40 |
Textually, records are separated by empty |
| 41 |
lines, while each field is encoded as one or more nonempty lines |
| 42 |
inside a record. |
| 43 |
. |
| 44 |
A field starts with its name, followed by a colon, |
| 45 |
followed by the field content. |
| 46 |
. |
| 47 |
The colon must reside on the first |
| 48 |
line of the field, and the first line must start with no whitespace. |
| 49 |
. |
| 50 |
Subsequent lines, in contrast, always start with linear whitespace |
| 51 |
(one or more space or tab characters). |
| 52 |
.PP |
| 53 |
The |
| 54 |
.B sort\-dctrl |
| 55 |
program recognizes two field types: string fields and version fields. |
| 56 |
Version fields act also as numeric fields. String fields are compared |
| 57 |
according to strict lexicographical octet-by-octet comparison, after |
| 58 |
ignoring any initial whitespace after the colon. Version fields are |
| 59 |
parsed and compared as Debian version numbers. When comparing version |
| 60 |
numbers, if a field content does not in fact conform to the version |
| 61 |
number syntax, it compares less than any field content that does |
| 62 |
conform, and equal to any other nonconforming field content. The |
| 63 |
.B sort\-dctrl |
| 64 |
program assumes all fields are string fields unless told otherwise. |
| 65 |
.PP |
| 66 |
You can specify arbitrary number of keys for sorting, using the |
| 67 |
.B \-k |
| 68 |
option. The keys are interpreted in a descending order of priority: |
| 69 |
the first key specified is primary, the second key specified is |
| 70 |
secondary, and so on. If two records compare equal under the primary |
| 71 |
key, then they are compared under the secondary key, and so on. If no |
| 72 |
keys are specified, a default key is assumed (the "Package" field with |
| 73 |
no modifiers). |
| 74 |
.SH OPTIONS |
| 75 |
.IP "\fB\-k \fIkeyspec\fR, \fB\-\-key-spec=\fIkeyspec" |
| 76 |
Specify one or more keys for sorting. You may specify this option any |
| 77 |
number of times. The |
| 78 |
.I keyspec |
| 79 |
argument consists of a comma-separated |
| 80 |
list of key specifications. Each key specification consists of the |
| 81 |
name of the field that serves as the key, optionally followed by a |
| 82 |
colon and key modifiers. The following key modifiers are supported: |
| 83 |
.RS |
| 84 |
.TP |
| 85 |
.B r |
| 86 |
Invert the comparison for this key, reversing the sorting order. |
| 87 |
.TP |
| 88 |
.B v |
| 89 |
Treat this field as a version number field. |
| 90 |
.TP |
| 91 |
.B n |
| 92 |
Treat this field as numeric, which currently is synonymous with |
| 93 |
.BR v . |
| 94 |
.RE |
| 95 |
.IP "\fB\-q\fR, \fB\-\-quiet\fR, \fB\-\-silent" |
| 96 |
Output nothing to the standard output stream. Instead, exit |
| 97 |
immediately after finding the first match. |
| 98 |
.IP "\fB\-l \fIlevel\fR, \fB\-\-errorlevel=\fIlevel" |
| 99 |
Set log level to |
| 100 |
.IR level . |
| 101 |
.I level |
| 102 |
is one of |
| 103 |
.BR fatal ", " important ", " informational " and " debug , |
| 104 |
but the last may not be available, |
| 105 |
depending on the compile-time options. These categories are given |
| 106 |
here in order; every message that is emitted when |
| 107 |
.B fatal |
| 108 |
is in effect, will be emitted in the |
| 109 |
.B important |
| 110 |
error level, and so on. The default is |
| 111 |
.BR important . |
| 112 |
.IP "\fB\-V\fR, \fB\-\-version" |
| 113 |
Print out version information. |
| 114 |
.IP "\fB\-C\fR, \fB\-\-copying" |
| 115 |
Print out the copyright license. This produces much output; be sure |
| 116 |
to redirect or pipe it somewhere (such as your favourite pager). |
| 117 |
.IP "\fB\-h\fR, \fB\-\-help" |
| 118 |
Print out a help summary. |
| 119 |
.SH EXAMPLES |
| 120 |
Here are some sample invocations of the program: |
| 121 |
.IP "sort\-dctrl /var/lib/dpkg/available" |
| 122 |
Output the |
| 123 |
.B dpkg |
| 124 |
.I available |
| 125 |
file sorted by the package name. |
| 126 |
.IP "sort\-dctrl -k Version:v /var/lib/dpkg/available" |
| 127 |
Output the |
| 128 |
.B dpkg |
| 129 |
.I available |
| 130 |
file sorted in ascending order of |
| 131 |
version numbers. |
| 132 |
.IP "sort\-dctrl -k Version:vr /var/lib/dpkg/available" |
| 133 |
Output the |
| 134 |
.B dpkg |
| 135 |
.I available |
| 136 |
file sorted in descending order of |
| 137 |
version numbers. |
| 138 |
.IP "sort\-dctrl -k Package,Version:v /var/lib/dpkg/available" |
| 139 |
Output the |
| 140 |
.B dpkg |
| 141 |
.I available |
| 142 |
file sorted primarily in ascending order of |
| 143 |
package names and secondarily in descending order of version numbers. |
| 144 |
.IP "sort\-dctrl -k Installed-Size:n,Size:nr /var/lib/dpkg/available" |
| 145 |
Output the |
| 146 |
.B dpkg |
| 147 |
.I available |
| 148 |
file sorted primarily in ascending order of |
| 149 |
installation sizes and secondarily in descending order of package |
| 150 |
sizes. |
| 151 |
.SH AUTHOR |
| 152 |
The program and this manual page were written by Antti-Juhani |
| 153 |
Kaijanaho <[email protected]>. |
| 154 |
.SH "SEE ALSO" |
| 155 |
Debian Policy Manual. Published as the Debian |
| 156 |
package |
| 157 |
.BR debian\-policy . |
| 158 |
Also available in the Debian website. |
| 159 |
.PP |
| 160 |
.BR grep-dctrl (1) |
| 161 |
\" Local variables: |
| 162 |
\" mode: nroff |
| 163 |
\" End: |
| 164 |
|