Re: scripting/regex help

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
To: Main PLUG discussion list
Subject: Re: scripting/regex help
Am 12. Jun, 2006 schwätzte Eric "Shubes" so:

> Here's a scripting problem I could use some help with.
>
> I have a variable x=qmail-toaster-1.2.9-1.3.1.src.rpm


Does rpm allow the seperator delimiter to be used in the package name?

binfmt-support_1.2.4ubuntu2_all.deb
binutils_2.16.1-2ubuntu6.1_i386.deb
binutils-static_2.16.1-2ubuntu6.1_i386.deb
irb1.8_1.8.2-9ubuntu1.1_all.deb

Note the dash in the package name and the underscore as the seperator
between the package name and the package version.

> I want a variable y=qmail-toaster
>
> I'm thinking that to get from x to y, I need to strip -*-*.src.rpm off the
> end. How do I do that? (or is there a better way?)


It looks to me like you need to strip off the last dash before numbers, dots,
dashes and .src.rpm. It also seems like the beginning of the substring to
drop starts with a dash followed by a number.

( x=qmail-toaster-1.2.9-1.3.1.src.rpm; y=${x%%-[0-9]*.src.rpm}; echo $y )
qmail-toaster

ciao,

der.hans
-- 
#  https://www.LuftHans.com/        http://www.CiscoLearning.org/
#  Join the League of Professional System Administrators! https://LOPSA.org/
#  "If class warfare is being waged in America, my class is clearly winning."
#    -- Warren Buffett
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss