bug-bash
[Top][All Lists]
Advanced

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

Question about patterns


From: Steven W. Orr
Subject: Question about patterns
Date: Thu, 23 Jun 2011 09:59:49 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11

I may be wrong, but I think there's a way to do what I want without using a 
regex.

I have a file called foo-1.2-3.tar.gz
I need to set a variable equal to
foo-1.2-i386-x86_64-3.tar.gz

Is there a way to do this without parsing my brains out? I am facile with the variable operations like # ## % %% and /, but what I really want to do is to say something like

bar=${foo/-([1-9]).tar.gz/-i386-x86_64-\1.tar.gz}

where the \1 is some sort of thing that I can use to refer to a backref. Does this exist in bash or do I just do it with a regex?

TIA :-)

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]