To just get the package description and/or "long description" of a Mac port, I can do this:

port info --description --long_description vim

and filter out information I don't need.

How can I do so in Ubuntu?

I have read the manual pages for the dpkg series as well as apt-cache and similar but I could find no fine-grained control on fields returned from the metadata database such as the above.

Is there an option on a command I missed? Should I resort to parsing and cutting the output?

In particular, I need the "long description" as a one-liner.

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

grep-aptavail and friends (grep-dctrl and grep-available, to find this information respectively in specific Packages files or in the dkpg base of locally installed packages) are the most precise tools for that:

grep-aptavail -s Description -PX packagename

Example:

$ grep-aptavail -PX 'apache2' -s Description
Description: Apache HTTP Server metapackage
 The Apache Software Foundation's goal is to build a secure, efficient and
 extensible HTTP server as standards-compliant open source software. The
 result has long been the number one web server on the Internet.
 .
 It features support for HTTPS, virtual hosting, CGI, SSI, IPv6, easy
 scripting and database integration, request/response filtering, many
 flexible authentication schemes, and more.*

Note:

Debian (and Ubuntu) packages have two parts in their description:

  • the first line of the Description field is the short description, which appears in apt-cache search packagename;
  • the rest of the Description field (beginning with the second line) is the long description.

For this reason, you can get the short description as a one-liner, but the long description is by definition spread on several lines.

link|improve this answer
Indeed, as you say, these are the most precise tools to get the intended output. Perfect, thank you. – Maroloccio May 26 '11 at 12:18
feedback

It's not exactly what you want, but

aptitude show packagename | grep ^Description:

should do the trick.

link|improve this answer
No, thanks but this is not what I am looking for. – Maroloccio May 26 '11 at 12:17
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.