Hello there,

I am exploring the possibilities of grep-dctrl.
My current experiment is to try and show the description of a package that is not necessarily installed.
I have defined a package.describe function in my .bashrc that does the following:

$ package.describe () { apt-cache show "$1" | grep-dctrl -s Description-en - }




I get desired result


16:40:35 ~ -1- $ package.describe syslog-summary
Description-en: summarize the contents of a syslog log file
 This program summarizes the contents of a log file written by syslog,
 by displaying each unique (except for the time) line once, and also
 the number of times such a line occurs in the input. The lines are
 displayed in the order they occur in the input.
 .
 It is also possible to define some "ignore rules" using regular
 expressions.
16:42:15 ~ -1- $




I tried to achieve the same w/o using apt-cache, but couldn't.
My failed attempts were :

1/
16:37:50 ~ -1- $ grep-dctrl -PX syslog-summary /var/lib/apt/lists/*_Packages                                       
Package: syslog-summary                                                                                                                                                                                                                       
Priority: optional                                                                                                                                                                                                                            
Section: universe/admin                                                                                                                                                                                                                       
Installed-Size: 80                                                                                                                                                                                                                            
Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>                                                                                                                                                                         
Original-Maintainer: David Paleino <da...@debian.org>                                                                                                                                                                                         
Architecture: all                                                                                                                                                                                                                             
Version: 1.14-2                                                                                                                                                                                                                               
Depends: python (>= 2.5)                                                                                                                                                                                                                      
Recommends: python-magic                                                                                                                                                                                                                      
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb                                                                                                                                                                        
Size: 9798                                                                                                                                                                                                                                    
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e                                                                                                                                                                                                      
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f                                                                                                                                                                                                
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b                                                                                                                                                                      
Description: summarize the contents of a syslog log file                                                                                                                                                                                      
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1                                                                                                                                                                                             
Bugs: https://bugs.launchpad.net/ubuntu/+filebug                                                                                                                                                                                              
Origin: Ubuntu                                                                                                                                                                                                                                
                                                                                                                                                                                                                                              
Package: syslog-summary                                                                                                                                                                                                                       
Priority: optional                                                                                                                                                                                                                            
Section: universe/admin                                                                                                                                                                                                                       
Installed-Size: 80                                                                                                                                                                                                                            
Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>                                                                                                                                                                         
Original-Maintainer: David Paleino <da...@debian.org>                                                                                                                                                                                         
Architecture: all                                                                                                                                                                                                                             
Version: 1.14-2                                                                                                                                                                                                                               
Depends: python (>= 2.5)                                                                                                                                                                                                                      
Recommends: python-magic                                                                                                                                                                                                                      
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb                                                                                                                                                                        
Size: 9798                                                                                                                                                                                                                                    
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e                                                                                                                                                                                                      
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f                                                                                                                                                                                                
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b                                                                                                                                                                      
Description: summarize the contents of a syslog log file                                                                                                                                                                                      
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1                                                                                                                                                                                             
Bugs: https://bugs.launchpad.net/ubuntu/+filebug                                                                                                                                                                                              
Origin: Ubuntu                                                                                                                                                                                                                                
                                                                                                                                                                                                                                              
16:39:07 ~ -1- $


Problem: Output has only 1-line description fields.
2/

16:40:30 ~ -1- $ grep-aptavail -PX syslog-summary                                                                                                                                                                                             
Package: syslog-summary                                                                                                                                                                                                                       
Priority: optional                                                                                                                                                                                                                            
Section: universe/admin                                                                                                                                                                                                                       
Installed-Size: 80                                                                                                                                                                                                                            
Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
Original-Maintainer: David Paleino <da...@debian.org>
Architecture: all
Version: 1.14-2
Depends: python (>= 2.5)
Recommends: python-magic
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb
Size: 9798
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b
Description: summarize the contents of a syslog log file
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

16:40:35 ~ -1- $





Problem: Same as with grep-dctrl, description is a one-liner.

Suggestions?

--
Yassine -- sysadm

Reply via email to