Manpages GREP-DCTRLSection: Debian user's manual (1)Updated: 2001-07-19 Index Return to Main Contents NAMEgrep-dctrl - grep Debian control filesSYNOPSISgrep-dctrl [ options ] pattern [ file ... ]grep-dctrl --copying | --help | --version | -ChV DESCRIPTIONThe grep-dctrl program can answer such questions as What is the Debian package foo?, Which version of the Debian package bar is now current?, Which Debian packages does John Doe maintain?, Which Debian packages are somehow related to the Scheme programming language?, and with some help, Who maintain the essential packages of a Debian system?, given a useful input file.It is a specialised grep program that is meant for processing any file which has the general format of a Debian package control file, as described in the Debian Packaging Manual. These include the dpkg available file, the dpkg status file, and the Packages files on a distribution medium (such as a Debian CD-ROM or an FTP site carrying Debian). You must give a search pattern on the command line. By default, the search is a case-sensitive fixed substring match on each paragraph (in other words, package record) in the input. With suitable command-line options, this can be changed: the search can be case-insensitive and the pattern can be seen as an extended POSIX regular expression. By default, the full matching paragraphs are printed on the standard output; specific fields can be selected for output with the -s option. One can also restrict the search to the body of particular fields; see the -F option. You can also search for packages that don't match a certain criteria; see the -v option. After the search pattern comes zero or more file names. If no file names are specified, the file name is searched in configuration files. The input file from the first program name - input file association with the correct program name is used. The program names are matched with the base form of the name of the current program (the 0'th command line argument, if you will). The file name "-" is taken to mean the standard input stream. The files are searched in order but separately; they are not concatenated together. In other words, the end of a file always implies the end of the current paragraph. OPTIONS
EXAMPLESThe following example queries assume that the default configuration is in effect.The almost simplest use of this program is to print out the status or available record of a package. In this respect, grep-dctrl is like dpkg -s or dpkg --print-avail. To print out the status record of the package "mixal", do % grep-status -PX mixaland to get its available record, use % grep-available -PX mixalIn fact, you can ask for the record of the "mixal" package from any Debian control file. Say, you have the Debian 2.2 CD-ROM's Packages file in the current directory; now you can do a % grep-dctrl -PX mixal Packages But grep-dctrl can do more than just emulate dpkg. It can more-or-less emulate apt-cache! That program has a search feature that searches package descriptions. But we can do that too: % grep-available -F Description foosearches for the string "foo" case-sensitively in the descriptions of all available packages. If you want case-insensitivity, use % grep-available -F Description -i fooTruth to be told, apt-cache searches package names, too. We can separately search in the names; to do so, do % grep-available -F Package fooor % grep-available -P foowhich is pretty much the same thing. We can also search in both descriptions and names; if match is found in either, the package record is printed: % grep-available -P -F Description fooor % grep-available -F Package -F Description fooThis kind of search is the exactly same that apt-cache does. Here's one thing neither dpkg nor apt-cache do. Search for a string in the whole status or available file (or any Debian control file, for that matter) and print out all package records where we have a match. Try % grep-available dpkgsometime and watch how thoroughly dpkg has infiltrated Debian. All the above queries were based on simple substring searches. But grep-dctrl can handle regular expressions in the search pattern. For example, to see the status records of all packages with either "apt" or "dpkg" in their names, use % grep-status -P -e 'apt|dpkg' Now that we have seen all these fine and dandy queries, you might begin to wonder whether it is necessary to always see the whole paragraph. You may be, for example, interest only in the dependency information of the packages involved. Fine. To show the depends lines of all packages maintained by me, do a % grep-available -F Maintainer -s Depends 'ajk@debian.org'If you want to see the packages' names, too, use % grep-available -F Maintainer -s Package,Depends \ 'ajk@debian.org'Note that there must be no spaces in the argument to the -s switch. You can do more complex (conjunctive) queries by using the Unix pipeline as a helper tool. This is usually most useful when you want to narrow down queries based on different patterns and different fields. For example, to see the list of packages maintained by me and depending on libc6, do % grep-available -F Maintainer -s Package,Depends \ 'ajk@debian.org' | grep-dctrl -F Depends -s Package libc6You can use other Unix filters to help you, too. Ever wondered, who's the most active Debian developer based on the number of source packages being maintained? Easy. You just need to have a copy of the most recent Sources file from any Debian mirror. % grep-dctrl -n -s Maintainer '' Sources | sort | uniq -c | sort -nrThis example shows a neat trick: if you want to selectively show only some field of all packages, just supply an empty pattern. The term "bogopackage" means the count of the packages that a Debian developer maintains. To get the bogopackage count for the maintainer of grep-dctrl, say % grep-available -FMaintainer --count \ "`grep-available -PX -sMaintainer -n grep-dctrl`" These examples cover a lot of typical uses of this utility, but not all possible uses. Use your imagination! The building blocks are there, and if something's missing, let me know. DIAGNOSTICSThese messages are emitted in log levels "fatal" and "important".
COMPATIBILITYIf you use grep-dctrl in a Debian package, you should depend on the grep-dctrl package and heed the following compatibility notes:
FILES
AUTHORThe program and this manual page were written by Antti-Juhani Kaijanaho <gaia@iki.fi>.SEE ALSOIan Jackson et al.: Debian Packaging Manual. Published as the Debian package packaging-manual. Also available in the Debian website. The Debian project, 1999.apt-cache(1), dpkg(1), dpkg-awk(1), sgrep(1)
IndexThis document was created by man2html, using the manual pages. Time: 23:21:51 GMT, February 06, 2025 |