Regexp for RPM package name, given its file name?
Paul Howarth
paul at city-fan.org
Fri Sep 2 20:35:22 UTC 2005
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 at city-fan.org>
More information about the fedora-list
mailing list