scripting/regex help

Jerry Davis jdawgaz at cox.net
Mon Jun 12 17:15:28 MST 2006


On Mon, 12 Jun 2006 17:04:06 -0700
Jerry Davis <jdawgaz at cox.net> wrote:

> On Mon, 12 Jun 2006 11:30:49 -0700
> "Eric \"Shubes\"" <plug at shubes.net> wrote:
> 
> > Jeremy C. Reed wrote:
> > > On Mon, 12 Jun 2006, Eric "Shubes" wrote:
> > > 
> > >> I have a variable x=qmail-toaster-1.2.9-1.3.1.src.rpm
> > >>
> > >> 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?)
> > > 
> > > sed -e 's,-[^-]*-[^-]*.src.rpm$,,'
> > > 
> > >  Jeremy C. Reed
> > > 
> > Excellent! I promise I'll study it until I understand how it works.
> > Thanks a bunch!
> 
> in bash, if that is what you are using:
> 
> x=qmail-toaster-1.2.9-1.3.1.src.rpm
> y=${x%.src.*rpm}

sorry that should be:
y=${x%-[^-]*-[^-]*.src.*rpm}

> 
> > 
> > -- 
> > -Eric 'shubes'
> > ---------------------------------------------------
> > PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> > To subscribe, unsubscribe, or to change  you mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> 
> 
> -- 
> Hobbit Name: Pimpernel Loamsdown
> Registered Linux User: 275424
>  
> This email's random fortune: Break into jail and claim police
> brutality. ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


-- 
Hobbit Name: Pimpernel Loamsdown
Registered Linux User: 275424
 
This email's random fortune: You may have heard that a dean is to
faculty as a hydrant is to a dog.
		-- Alfred Kahn


More information about the PLUG-discuss mailing list