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

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

 



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


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

  Powered by Linux