[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting wide ``dpkg -l'' output in scripts and pipes.



Adam Funk wrote:

(Sorry about the long lines but they illustrate the output I'm
 talking about.)

``dpkg -l'' on its own in a terminal produces wide output, e.g.:

$ dpkg -l perl*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                                Version                             Description
+++-===================================-===================================-======================================================================================
ii  perl                                5.8.3-3                             Larry Wall's Practical Extraction and Report Language.
....

but when I send its output to a pipe or a file, I get narrow output:

$ dpkg -l perl* |head
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  perl           5.8.3-3        Larry Wall's Practical Extraction and Report
....

I want to dump a complete list of installed packages to a file as part of my backup procedure. man dpkg-query suggests using --showformat=format, in particular: "Package information can be included by inserting variable references to package fields using the ${var[;width]} syntax." But it doesn't say what the variable
names are.  Suggestions?

Thanks,
Adam


How about dpkg --get-selections



Reply to: