what about using rpm instead of yum?<div><br></div><div>rpm -qa --queryformat &#39;%{name}\n&#39;</div><div><br></div><div>-Scott<br><br><div class="gmail_quote">On Sun, Sep 6, 2009 at 2:00 PM, Richard Bronosky <span dir="ltr">&lt;<a href="mailto:Richard@bronosky.com">Richard@bronosky.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Sun, Sep 6, 2009 at 11:13 AM, Matty&lt;<a href="mailto:matty91@gmail.com">matty91@gmail.com</a>&gt; wrote:<br>
&gt; Howdy,<br>
&gt;<br>
&gt; Does anyone happen to have a sed recipe to split a package name like:<br>
&gt;<br>
&gt; yum-metadata-parser-1.1.2-12.fc11.x86_64<br>
&gt;<br>
&gt; Into:<br>
&gt;<br>
&gt; $1 -&gt; yum-metadata-parser<br>
&gt; $2 -&gt; -1.*<br>
&gt;<br>
&gt; I have a working solution in perl and python, but sed is another story.<br>
<br>
This is really just a regex problem. What you did in perl is probably<br>
really close to working in sed. If you would like help building the<br>
regex, it would help to have more info on where the package name is<br>
coming from. Since sed works on entire lines, the additional context<br>
may require you/us to rewrite the regex if it is made to work with<br>
only what you have given us so far. Here are some examples of possible<br>
sources that I thought of. All of which would require slightly<br>
different processing.<br>
<br>
[root@slice1 etc]# head /var/log/yum.log<br>
Aug 29 03:22:52 Installed: 2:vim-common-7.0.109-4.el5_2.4z.x86_64<br>
Aug 29 03:22:54 Installed: gpm-1.20.1-74.1.x86_64<br>
Aug 29 03:22:54 Installed: 2:vim-enhanced-7.0.109-4.el5_2.4z.x86_64<br>
Aug 29 03:22:54 Installed: screen-4.0.3-1.el5.x86_64<br>
Aug 29 03:32:03 Installed: apr-1.2.7-11.el5_3.1.x86_64<br>
Aug 29 03:32:03 Installed: postgresql-libs-8.1.11-1.el5_1.1.x86_64<br>
Aug 29 03:32:03 Installed: apr-util-1.2.7-7.el5_3.2.x86_64<br>
Aug 29 03:32:04 Installed: httpd-2.2.3-22.el5.centos.2.x86_64<br>
Aug 29 03:34:51 Installed: perl-DBI-1.52-2.el5.x86_64<br>
Aug 29 03:34:52 Installed: mysql-5.0.45-7.el5.x86_64<br>
<br>
[root@slice1 etc]# yum list installed|head<br>
Loaded plugins: fastestmirror<br>
Installed Packages<br>
MAKEDEV.x86_64                            3.23-1.2                     installed<br>
SysVinit.x86_64                           2.86-15.el5                  installed<br>
acl.x86_64                                2.2.39-3.el5                 installed<br>
acpid.x86_64                              1.0.4-7.el5                  installed<br>
amtu.x86_64                               1.0.6-1.el5                  installed<br>
anacron.x86_64                            2.3-45.el5.centos            installed<br>
apr.i386                                  1.2.7-11.el5_3.1             installed<br>
apr.x86_64                                1.2.7-11.el5_3.1             installed<br>
<br>
[root@slice1 etc]# yum list available|head<br>
Loaded plugins: fastestmirror<br>
Loading mirror speeds from cached hostfile<br>
 * base: <a href="http://mirrors.tummy.com" target="_blank">mirrors.tummy.com</a><br>
 * updates: <a href="http://mc-builds.org" target="_blank">mc-builds.org</a><br>
 * addons: <a href="http://mirror.rackspace.com" target="_blank">mirror.rackspace.com</a><br>
 * extras: <a href="http://mirrors.serveraxis.net" target="_blank">mirrors.serveraxis.net</a><br>
Available Packages<br>
Cluster_Administration-as-IN.noarch        5.2-1.el5.centos              base<br>
Cluster_Administration-bn-IN.noarch        5.2-1.el5.centos              base<br>
Cluster_Administration-de-DE.noarch        5.2-1.el5.centos              base<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
</blockquote></div><br></div>