Regexp for RPM package name, given its file name?

Vladimir G. Ivanovic vladimir at acm.org
Fri Sep 2 20:50:08 UTC 2005


Your sed command looks like a winner. Thanks!

--- Vladimir

-- 
Vladimir G. Ivanovic
Palo Alto, CA 94306
+1 650 678 8014

>>>>> "ph" == Paul Howarth <paul at city-fan.org> writes:

    ph> 
    ph> 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).
    ph> 
    ph> If you actually have the files, you can just use rpm to extract the name
    ph> from the rpm file itself:
    ph> 
    ph> $ rpm -qp --qf '%{NAME}' some.rpm
    ph> 
    ph> This will work even if the rpm file has been renamed to something
    ph> completely different.
    ph> 
    ph> If you're just working from names, try this:
    ph> 
    ph> sed 's/-[^-]*-[^-]*$//' /var/log/rpmpkgs
    ph> 
    ph> Paul.
    ph> -- 
    ph> Paul Howarth <paul at city-fan.org>
    ph> 
    ph> -- 
    ph> fedora-list mailing list
    ph> fedora-list at redhat.com
    ph> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    ph> 




More information about the users mailing list