Re: Get list of installed packages

2014-02-06 Thread Jonathan Dowland
On 06/02/2014 13:06, Tino Sino wrote: > I wonder, what's the golden way to do this and why? It depends on what you're doing it for. If it's for a script, dpkg-query is a better choice, because you can do --showformat and it does not truncate version strings etc. 'dpkg -l' output is really meant fo

Re: Get list of installed packages

2014-02-06 Thread Jonathan Dowland
On 06/02/2014 13:12, Gian Uberto Lauri wrote: > (you could use grep -e '^ii') or egrep '^ii', but I think it's not > worth the cpu used). You don't need -e to use anchors in the regex. Whilst -e would use more CPU than a plain grep, the anchor would likely reduce the work done (lines can be matche

Re: Get list of installed packages

2014-02-06 Thread Nicolas Bercher
On 06/02/2014 14:06, Tino Sino wrote: It has been asked before, but with different answers, e.g.: 1) dpkg-query --list | awk '/^ii +/ { print $2; }' 2) dpkg --get-selections | cut -f 1 3) ... etc ... Given that the output is the same: $ diff \ <(dpkg --get-selections | cut -f 1) \

Re: Get list of installed packages

2014-02-06 Thread Paul Cartwright
On 02/06/2014 08:17 AM, iijima yoshino wrote: > ?? Thu, 06 Feb 2014 14:06:44 +0100 > Tino Sino : > >> It has been asked before, but with different answers, e.g.: >> 1) dpkg-query --list | awk '/^ii +/ { print $2; }' >> 2) dpkg --get-selections | cut -f 1 >> 3) ... etc ... >> Given that the out

Re: Get list of installed packages

2014-02-06 Thread iijima yoshino
?? Thu, 06 Feb 2014 14:06:44 +0100 Tino Sino : > It has been asked before, but with different answers, e.g.: > 1) dpkg-query --list | awk '/^ii +/ { print $2; }' > 2) dpkg --get-selections | cut -f 1 > 3) ... etc ... > Given that the output is the same: > $ diff \ > <(dpkg --get-selec

Re: Get list of installed packages

2014-02-06 Thread Gian Uberto Lauri
Tino Sino writes: > It has been asked before, but with different answers, e.g.: > 1) dpkg-query --list | awk '/^ii +/ { print $2; }' > 2) dpkg --get-selections | cut -f 1 > 3) ... etc ... > Given that the output is the same: > $ diff \ > <(dpkg --get-selections | cut -f 1) \ >

Get list of installed packages

2014-02-06 Thread Tino Sino
It has been asked before, but with different answers, e.g.: 1) dpkg-query --list | awk '/^ii +/ { print $2; }' 2) dpkg --get-selections | cut -f 1 3) ... etc ... Given that the output is the same: $ diff \ <(dpkg --get-selections | cut -f 1) \ <(dpkg-query --list | awk '/^ii +/ { pri