I recently looked for a way for aptitude to print only the installed packages from my search terms. I looked into the man pages with no luck. Then it occurred to me it would be very easy to pipe the result to grep utility.
So, while:
# aptitude search openoffice
p openoffice.org-base-core - OpenOffice.org office suite -- libdba
v openoffice.org-bundled -
c openoffice.org-calc - OpenOffice.org office suite - spreadsheet
i A openoffice.org-common - OpenOffice.org office suite architecture
returns too much results (which I trimmed to show here),
# aptitude search openoffice | grep ^i
i A openoffice.org-common - OpenOffice.org office suite architecture i
i A openoffice.org-style-andromeda - Default symbol style for OpenOffice.org
i A openoffice.org-style-crystal - Crystal symbol style for OpenOffice.org
i openoffice.org-style-hicontrast - Hicontrast symbol style for OpenOffice.org
i openoffice.org-style-industrial - Industrial symbol style for OpenOffice.org
only returns installed packages.
The trick is the input to grep utility, the ^i. It instructs grep to hold only those lines which start with the letter "i". Neat isn't it?
aptitude show installed packages