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

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

 



Your sed command looks like a winner. Thanks!

--- Vladimir

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

>>>>> "ph" == Paul Howarth <paul@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
    ph> 
    ph> -- 
    ph> fedora-list mailing list
    ph> fedora-list@xxxxxxxxxx
    ph> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    ph> 


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

  Powered by Linux