Advertisement

03.08.2007 at 04:11AM PST, ID: 22436097
[x]
Attachment Details

unix shell script renaming files

Asked by Samooramad in Operating Systems Development, Bourne Shell (sh), Shell Scripting

Tags: rename, shell, script, unix, files

Hi experts,

I have a shell script that runs fine, I want to add some code in there to find any files in the current directory named like *_GAP2_0.txt and change it to *_GAP2_7.txt
so the files
QW_GAP2_0.txt
GD_GAP2_0.txt
UY_GAP2_0.txt

should all be changed to
QW_GAP2_7.txt
GD_GAP2_7.txt
UY_GAP2_7.txt

I tried using
mv *_GAP2_0.txt  *_GAP2_7.txt

but that gives an error, so how can i do it?

Thanks


Start Free Trial
[+][-]03.08.2007 at 04:29AM PST, ID: 18678021

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2007 at 12:45PM PST, ID: 18682593

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Operating Systems Development, Bourne Shell (sh), Shell Scripting
Tags: rename, shell, script, unix, files
Sign Up Now!
Solution Provided By: Tintin
Participating Experts: 3
Solution Grade: A
 
 
[+][-]03.09.2007 at 12:46AM PST, ID: 18685916

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.09.2007 at 11:41AM PST, ID: 18689863

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.09.2007 at 11:50PM PST, ID: 18693034

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32