Re: Regexp for RPM package name, given its file name?

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

 



On Fri, 2005-09-02 at 12:46 -0700, Vladimir G. Ivanovic wrote:
> Is there a regexp that will pick out the name of an RPM package, given
> its file name?
> 
> The shell command
> 
>    egrep -o "^[^.]*-" /var/log/rpmpkgs
> 
> does a pretty good job, but includes part of the version with packages
> that use numbers without periods (see below).

If you actually have the files, you can just use rpm to extract the name
from the rpm file itself:

$ rpm -qp --qf '%{NAME}' some.rpm

This will work even if the rpm file has been renamed to something
completely different.

If you're just working from names, try this:

sed 's/-[^-]*-[^-]*$//' /var/log/rpmpkgs

Paul.
-- 
Paul Howarth <paul@xxxxxxxxxxxx>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux