[plug] re: awk
Craig Ringer
craig at postnewspapers.com.au
Sun Jul 20 20:42:38 WST 2003
> `awk` would certainly do the job. `sed` or `cut` might be easier,
> though. (Craig suggested `cut` -- it should have the most obvious
> usage.)
Unfortunately, it can't. Example RPM output:
bzip2-libs-1.0.2-8
glib-1.2.10-10
losetup-2.11y-9
shadow-utils-4.0.3-6
MAKEDEV-3.3.2-5
hotplug-2002_04_01-17
findutils-4.1.7-9
modutils-2.4.22-8
sed-4.0.5-1
...
As you see, pkgnames can contain hyphens, which are also used to
separate out the version from the pkgname. I suppose you could assume
that any -[\d] sequence was the beginning of the version, but nothing
stops someone having a pakgename of 'something-3d' for example. *sigh*.
RPM's format print output options are the only way I can see to do it -
as well as the way with the least messing about.
Hyphens should probably have been forbidden in pkgnames, but it's a bit
late now...
Craig Ringer
More information about the plug
mailing list