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

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



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 city-fan org>


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