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

Re: Listing only the package names with dpkg?



Preben Randhol wrote:

> I'm trying to list out all the packages I have installed on my system.
> I can do a dpkg -l, but I only want the package names not the rest, as
> I'm going to use the package names.
>
> dpkg -l gives:
>
> ii  xfonts-scalabl 3.3.6-2        scalable fonts for X
> ii  xfree86-common 3.3.6-10       X Window System (XFree86) infrastructure
>
> I would like to have:
>
> xfonts-scalable_3.3.6-2
> xfree86-common_3.3.6-10
> etc...

This should do what you ask,

$ dpkg -l | gawk '{print $2"_" $3}'

But actually, I kinda prefer this one.

$ dpkg -l | gawk '{printf ("%-20.20s %s\n", $2"___________________",$3)}

John

--

Powered by the Penguin





Reply to: