[ale] Using sed to print package names

scott mcbrien smcbrien at gmail.com
Sun Sep 6 14:08:26 EDT 2009


what about using rpm instead of yum?
rpm -qa --queryformat '%{name}\n'

-Scott

On Sun, Sep 6, 2009 at 2:00 PM, Richard Bronosky <Richard at bronosky.com>wrote:

> On Sun, Sep 6, 2009 at 11:13 AM, Matty<matty91 at gmail.com> wrote:
> > Howdy,
> >
> > Does anyone happen to have a sed recipe to split a package name like:
> >
> > yum-metadata-parser-1.1.2-12.fc11.x86_64
> >
> > Into:
> >
> > $1 -> yum-metadata-parser
> > $2 -> -1.*
> >
> > I have a working solution in perl and python, but sed is another story.
>
> This is really just a regex problem. What you did in perl is probably
> really close to working in sed. If you would like help building the
> regex, it would help to have more info on where the package name is
> coming from. Since sed works on entire lines, the additional context
> may require you/us to rewrite the regex if it is made to work with
> only what you have given us so far. Here are some examples of possible
> sources that I thought of. All of which would require slightly
> different processing.
>
> [root at slice1 etc]# head /var/log/yum.log
> Aug 29 03:22:52 Installed: 2:vim-common-7.0.109-4.el5_2.4z.x86_64
> Aug 29 03:22:54 Installed: gpm-1.20.1-74.1.x86_64
> Aug 29 03:22:54 Installed: 2:vim-enhanced-7.0.109-4.el5_2.4z.x86_64
> Aug 29 03:22:54 Installed: screen-4.0.3-1.el5.x86_64
> Aug 29 03:32:03 Installed: apr-1.2.7-11.el5_3.1.x86_64
> Aug 29 03:32:03 Installed: postgresql-libs-8.1.11-1.el5_1.1.x86_64
> Aug 29 03:32:03 Installed: apr-util-1.2.7-7.el5_3.2.x86_64
> Aug 29 03:32:04 Installed: httpd-2.2.3-22.el5.centos.2.x86_64
> Aug 29 03:34:51 Installed: perl-DBI-1.52-2.el5.x86_64
> Aug 29 03:34:52 Installed: mysql-5.0.45-7.el5.x86_64
>
> [root at slice1 etc]# yum list installed|head
> Loaded plugins: fastestmirror
> Installed Packages
> MAKEDEV.x86_64                            3.23-1.2
> installed
> SysVinit.x86_64                           2.86-15.el5
>  installed
> acl.x86_64                                2.2.39-3.el5
> installed
> acpid.x86_64                              1.0.4-7.el5
>  installed
> amtu.x86_64                               1.0.6-1.el5
>  installed
> anacron.x86_64                            2.3-45.el5.centos
>  installed
> apr.i386                                  1.2.7-11.el5_3.1
> installed
> apr.x86_64                                1.2.7-11.el5_3.1
> installed
>
> [root at slice1 etc]# yum list available|head
> Loaded plugins: fastestmirror
> Loading mirror speeds from cached hostfile
>  * base: mirrors.tummy.com
>  * updates: mc-builds.org
>  * addons: mirror.rackspace.com
>  * extras: mirrors.serveraxis.net
> Available Packages
> Cluster_Administration-as-IN.noarch        5.2-1.el5.centos
>  base
> Cluster_Administration-bn-IN.noarch        5.2-1.el5.centos
>  base
> Cluster_Administration-de-DE.noarch        5.2-1.el5.centos
>  base
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20090906/c2b71c11/attachment.html 


More information about the Ale mailing list