Thanks Aaron & Tom - 
That's progress, but not there yet. ;)  
Further suggestion? Thanks :)

On Sun, 27 Jun 2010 04:39:41 -0400, "Tom H" <tomh0...@gmail.com> said:
> On Sat, Jun 26, 2010 at 7:57 PM, giovanni_re <john...@fastmail.us> wrote:
> > Is there a way to mashup "apt-cache search <SearchTerm>" & "dpkg -l"
> > - so that given a SearchTerm,
> > it would find all the related package names in the cache,
> > then do a "dpkg -l" on those package names?
> 
> No need for dpkg.
> 
> aptitude -F "%c%a %p %v %d" search '?narrow(?installed,searchterm)'

One key point is that the output should include every package returned
by 
"apt-cache search <SearchTerm>"
& show whether or not they are installed.


=====  Example showing the concept, using package "parted":

1)  First, here are all the packages apt-cache returns:

# apt-cache search parted | sort
drobo-utils - manage data robotics storage units (drobos)
fatresize - FAT16/FAT32 filesystem resizer
gnu-fdisk - Linux fdisk replacement based on libparted
gparted - GNOME partition editor
kvpm - LVM frontend for KDE
libparted0debian1-dbg - The GNU Parted disk partitioning library debug
development files
libparted0debian1 - The GNU Parted disk partitioning shared library
libparted0-dev - The GNU Parted disk partitioning library development
files
libparted0-i18n - The GNU Parted disk partitioning library i18n support
libparted0 - The GNU Parted disk partitioning shared library (old name)
parted-doc - The GNU Parted disk partition resizing program
documentation
parted - The GNU Parted disk partition resizing program
partitionmanager - A partition management utility
python-parted-dbg - Python interface for libparted - Debugging symbols
python-parted - Python interface for libparted



2)  But "dpkg -l"  only shows some of them:

dpkg -l | grep parted
ii  gparted                              0.5.1-1ubuntu2                 
                GNOME partition editor
ii  libparted0                           2.2-5ubuntu5                   
                The GNU Parted disk partitioning shared libr
ii  libparted0debian1                    2.2-5ubuntu5                   
                The GNU Parted disk partitioning shared libr
ii  parted                               2.2-5ubuntu5                   
                The GNU Parted disk partition resizing progr


{  For reference, here are 2 more dpkg -l searches:

dpkg -l parted
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                          
 Description
+++-==================================-==================================-====================================================================================
ii  parted                             2.2-5ubuntu5                     
 The GNU Parted disk partition resizing program

dpkg -l '*parted*'
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                          
 Description
+++-==================================-==================================-====================================================================================
ii  gparted                            0.5.1-1ubuntu2                   
 GNOME partition editor
un  libparted                          <none>                           
 (no description available)
ii  libparted0                         2.2-5ubuntu5                     
 The GNU Parted disk partitioning shared library (old name)
un  libparted0-dev                     <none>                           
 (no description available)
un  libparted0-i18n                    <none>                           
 (no description available)
ii  libparted0debian1                  2.2-5ubuntu5                     
 The GNU Parted disk partitioning shared library
un  libparted1                         <none>                           
 (no description available)
un  libparted1.4                       <none>                           
 (no description available)
un  libparted2                         <none>                           
 (no description available)
un  nparted                            <none>                           
 (no description available)
ii  parted                             2.2-5ubuntu5                     
 The GNU Parted disk partition resizing program
un  parted-doc                         <none>                           
 (no description available)
un  parted1.6                          <none>                           
 (no description available)

}


3a)  I'd like to get an output list including all the packages from step
1 above,
3b)  Showing the package name, & its installed status (ii, un, etc) like
from step 2.

Note:  One way might be to:
1) Do the apt-cache search <packagename>
2) For each line
2a) Pull out the package name
2b) Write an apt-cache search for that name only to a temp file
3) Do the dpkg -l 's from the file
3b) & remove from the output all the dpkg heading info, leaving only the
package status lines.

Can you get that mashup?  Thanks :)



==========   RESULTS SO FAR:  ==========
=====  From tomh0665
# aptitude -F "%c%a %p %v %d" search '?narrow(?installed,parted)'
i  gparted                                                              
0.5.1-1ubu GNOME partition editor                                        
i  libparted0                                                           
2.2-5ubunt The GNU Parted disk partitioning shared library (old name)    
i  libparted0debian1                                                    
2.2-5ubunt The GNU Parted disk partitioning shared library               
i  parted                                                               
2.2-5ubunt The GNU Parted disk partition resizing program                

:  The good thing here is this shows the package installed status.
:  But it is missing many of the packages shown by "apt-cache search
parted", many of which are probably not installed.


=====  From  aaron.toponce
alias apt-search="aptitude search"

# dpkg -l $(apt-search parted |grep ^i|awk '{print $2}'|tr '\n' ' ')
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                          
 Description
+++-==================================-==================================-====================================================================================
ii  gparted                            0.5.1-1ubuntu2                   
 GNOME partition editor
ii  parted                             2.2-5ubuntu5                     
 The GNU Parted disk partition resizing program
No packages found matching A.
No packages found matching A.


: The good result here is that this shows the dpkg -l, which can show
uninstalled or failed match packages.
: But it doesn't yet get all the packages.


==
Aaron & Tom - can you mash this up a little better?  Thanks  :)


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/1277670238.17760.1382135...@webmail.messagingengine.com

Reply via email to