| 1 |
.TH tbl\-dctrl 1 2006-04-02 "Debian Project" "Debian administrator's manual" |
| 2 |
\" Copyright (C) 2005, 2010 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 |
tbl\-dctrl \- generate tabular representations of data in dctrl format |
| 19 |
.SH SYNOPSIS |
| 20 |
.B tbl\-dctrl |
| 21 |
[ |
| 22 |
.I options |
| 23 |
] [ |
| 24 |
.B \-c |
| 25 |
.IR column\-specification " ..." |
| 26 |
] |
| 27 |
[ |
| 28 |
.I filename |
| 29 |
] ... |
| 30 |
.sp |
| 31 |
.B tbl\-dctrl |
| 32 |
.B \-\-version |
| 33 |
.sp |
| 34 |
.B tbl\-dctrl |
| 35 |
.B \-\-help |
| 36 |
.SH DESCRIPTION |
| 37 |
.B tbl\-dctrl |
| 38 |
creates tabular representations of data given to it in Debian control |
| 39 |
file format. |
| 40 |
.PP |
| 41 |
By default, |
| 42 |
.B tbl\-dctrl |
| 43 |
reads the whole database, looking for the longest entry in each |
| 44 |
requested column; it then outputs a table, with borders and column |
| 45 |
titles, where each column is just wide enough to fit the longest |
| 46 |
entry. |
| 47 |
. |
| 48 |
Most of this behaviour can be customized as described below. |
| 49 |
.PP |
| 50 |
A column is requested by specifying the |
| 51 |
.BR \-c " (" \-\-column ) |
| 52 |
switch with a column specification. |
| 53 |
. |
| 54 |
The simplest kind of a column specification consists solely of the name |
| 55 |
of a field. |
| 56 |
. |
| 57 |
In such a case, |
| 58 |
.B tbl\-dctrl |
| 59 |
will include in the output a column whose title is the literal column |
| 60 |
specification and whose data is drawn from fields with that name. |
| 61 |
. |
| 62 |
If no |
| 63 |
.B \-c |
| 64 |
options are given, |
| 65 |
.B tbl\-dctrl |
| 66 |
will use all fields in the input in the order in which they first appear. |
| 67 |
.PP |
| 68 |
There are two optional additions one can make to a column |
| 69 |
specification. |
| 70 |
. |
| 71 |
Prefixing the field name with some text followed by an equality sign |
| 72 |
(for example, |
| 73 |
.BR "\-c 'Package name=Package'" ) |
| 74 |
modifies the column in such a way that the text before the equality |
| 75 |
sign is used as the column title, while the text after the equality |
| 76 |
sign is used as the name of the field from which data is drawn. |
| 77 |
. |
| 78 |
One can also append a colon followed by a positive whole number to the |
| 79 |
field name. In such a case, the number after the colon specifies the |
| 80 |
width of the column. |
| 81 |
. |
| 82 |
These two additions can be used separately or together. |
| 83 |
. |
| 84 |
If there are more than one colon, the last one is significant. |
| 85 |
. |
| 86 |
If there are more than one equals sign, the first one is significant. |
| 87 |
. |
| 88 |
Other colons and equals signs are used simply as data. |
| 89 |
. |
| 90 |
Note that the whole column specification must be given to |
| 91 |
.B tbl\-dctrl |
| 92 |
as one argument, so if it contains spaces, it must be quoted for the |
| 93 |
shell. |
| 94 |
.PP |
| 95 |
If all requested columns have a specified width, |
| 96 |
.B tbl\-dctrl |
| 97 |
will produce output immediately, not waiting for the whole input to be |
| 98 |
read in. |
| 99 |
.SH OPTIONS |
| 100 |
.IP "\fB\-d \fIdelimiter\fR, \fB\-\-delimiter=\fIdelimiter" |
| 101 |
Instead of drawing nice borders to the table, use the specified |
| 102 |
.I delimiter |
| 103 |
string to delimit columns in a row. |
| 104 |
.IP "\fB\-H\fR, \fB\-\-no\-heading |
| 105 |
Do not print a table heading (column titles). |
| 106 |
.IP "\fB\-l \fIlevel\fR, \fB\-\-errorlevel=\fIlevel" |
| 107 |
Set log level to |
| 108 |
.IR level . |
| 109 |
.I level |
| 110 |
is one of |
| 111 |
.BR fatal ", " important ", " informational " and " debug , |
| 112 |
but the last may not be available, |
| 113 |
depending on the compile-time options. These categories are given |
| 114 |
here in order; every message that is emitted when |
| 115 |
.B fatal |
| 116 |
is in effect, will be emitted in the |
| 117 |
.B important |
| 118 |
error level, and so on. The default is |
| 119 |
.BR important . |
| 120 |
.TP |
| 121 |
.BR \-V ", " \-\-version |
| 122 |
Print out version information. |
| 123 |
.TP |
| 124 |
.BR \-C ", " \-\-copying |
| 125 |
Print out the copyright license. This produces much output; be sure |
| 126 |
to redirect or pipe it somewhere (such as your favourite pager). |
| 127 |
.TP |
| 128 |
.BR \-h ", " \-\-help |
| 129 |
Print out a help summary. |
| 130 |
.SH OPERANDS |
| 131 |
.B tbl\-dctrl |
| 132 |
will read its input from the files named on the command line, |
| 133 |
in the specified order. |
| 134 |
. |
| 135 |
A file called |
| 136 |
.B \- |
| 137 |
represents the program's standard input stream. |
| 138 |
. |
| 139 |
If no files are named, the program behaves as if |
| 140 |
.B \- |
| 141 |
alone had been named, that is, input is read from the standard input |
| 142 |
stream. |
| 143 |
.SH STDIN |
| 144 |
The standard input stream may be used as input as specified above in |
| 145 |
the |
| 146 |
.B OPERANDS |
| 147 |
section. |
| 148 |
.SH "INPUT FILES" |
| 149 |
All input to |
| 150 |
.B tbl\-dctrl |
| 151 |
is in the format of a Debian control file. |
| 152 |
.PP |
| 153 |
A Debian control (dctrl) file is a semistructured single-table |
| 154 |
database stored in a machine-parseable text file. |
| 155 |
. |
| 156 |
Such a database consists of a set of records; each record is a mapping |
| 157 |
from field names to field content. |
| 158 |
. |
| 159 |
Textually, records are separated by empty lines, while each field is |
| 160 |
encoded as one or more nonempty lines inside a record. |
| 161 |
. |
| 162 |
A field starts with its name, followed by a colon, followed by the |
| 163 |
field content. |
| 164 |
. |
| 165 |
The colon must reside on the first line of the field, and the first |
| 166 |
line must start with no whitespace. |
| 167 |
. |
| 168 |
Subsequent lines, in contrast, always start with linear whitespace |
| 169 |
(one or more space or tab characters). |
| 170 |
.PP |
| 171 |
When input is read from multiple files, a record separator is implicit |
| 172 |
between two adjacent files. |
| 173 |
.SH "ENVIRONMENT VARIABLES" |
| 174 |
The standard locale environment, specifically its character set |
| 175 |
setting, affects the interpretation of input and output as character |
| 176 |
streams. |
| 177 |
.SH "ASYNCHRONOUS EVENTS" |
| 178 |
Standard UNIX signals have their usual meaning. |
| 179 |
.SH STDOUT |
| 180 |
All output is sent to the standard output stream. |
| 181 |
. |
| 182 |
The output is a tabular representation of the input database restricted |
| 183 |
to the specified fields. Logically, the output is a table; when the |
| 184 |
.B \-d |
| 185 |
option is used, this table is represented simply by separating columns |
| 186 |
in each row by the specified |
| 187 |
.IR delimiter ; |
| 188 |
when the option is not used, a |
| 189 |
frame is drawn around the table. The order of the columns is the same |
| 190 |
as the order of the column specifications on the command line. |
| 191 |
.SH "OUTPUT FILES" |
| 192 |
There are no output files. |
| 193 |
.SH "EXIT STATUS" |
| 194 |
This utility exits with |
| 195 |
.B 0 |
| 196 |
when successful. It uses a nonzero exit |
| 197 |
code inconsistently when an error is noticed (this is a bug). |
| 198 |
.SH "CONSEQUENCES OF ERRORS" |
| 199 |
In case of errors in the input, the output will be partially or |
| 200 |
completely garbage. In case of errors in invocation, the program will |
| 201 |
refuse to function. |
| 202 |
.SH "EXAMPLES" |
| 203 |
The following command line pipe outputs a table of all packages, with |
| 204 |
their maintainer data, sorted by the maintainer data, that have no |
| 205 |
content: |
| 206 |
.nf |
| 207 |
% grep\-available \-FInstalled\-Size \-\-eq 0 | sort\-dctrl \-kMaintainer \- \\ |
| 208 |
| tbl\-dctrl \-cPackage \-cMaintainer |
| 209 |
.fi |
| 210 |
.SH AUTHOR |
| 211 |
The |
| 212 |
.B tbl\-dctrl |
| 213 |
program and this manual page were written by Antti-Juhani Kaijanaho. |
| 214 |
.SH "SEE ALSO" |
| 215 |
.BR apt\-cache (1), |
| 216 |
.BR ara (1), |
| 217 |
.BR dpkg\-awk (1), |
| 218 |
.BR dpkg\-query (1), |
| 219 |
.BR grep\-dctrl (1), |
| 220 |
.BR sort\-dctrl (1), |
| 221 |
.BR dpkg (8) |
| 222 |
|