Regexp for RPM package name, given its file name?
William Hooper
whooperhsd3 at earthlink.net
Fri Sep 2 20:04:07 UTC 2005
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 take a look at the cron script that generates /var/log/rpmpkgs, you
can see it is just a rpm query with a specified format. Adjusting this
query to give you just the name would give you:
rpm -qa --qf '%{name}'
You might also be interested in piping it through "sort", as the cron
script does.
--
William Hooper
More information about the fedora-list
mailing list