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

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



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


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