LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-19-2007, 09:12 AM   #1
ajcns
LQ Newbie
 
Registered: Jun 2006
Posts: 17

Rep: Reputation: 0
Renaming multiple files


Hi,
I need to rename multiple files. Can anyone write be a simple script?
I want to replace only certain portion of the file name. For example, in the file name "James_Bond_007_axial image.jpg" I want to replace only the name James_Bond with say George_Bush, leaving 007_axial image.jpg intact.

I have tried mmv and mvb renaming programs but don't know exactly how to word the script.

Thanks,
AJ
 
Old 01-19-2007, 09:51 AM   #2
asommer
Member
 
Registered: Mar 2003
Location: North Carolina
Distribution: Gentoo
Posts: 168

Rep: Reputation: 30
Here's one way to do it:

Code:
for i in *_axial image.jpg; do mv $i 
`echo $i | sed -e s/_axial image.jpg/whatever_you_want_to_rename_to/`; done;
Assuming you're in the directory with the files you want to rename. If not change *_axial image.jpg to /wherever/*_axial image.jpg.
 
Old 01-19-2007, 11:04 PM   #3
ajcns
LQ Newbie
 
Registered: Jun 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,
thanks so much. It worked.
Sincerely,
AJ
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
renaming multiple files linuxhippy Slackware 10 01-21-2011 01:53 AM
Linux 101 - Renaming Multiple Files ????? perry Linux - Newbie 3 04-08-2006 09:09 PM
renaming multiple files in general kkatebian Linux - General 5 11-06-2005 11:05 AM
Renaming multiple files with the same format Shr00mBoXx Slackware 7 06-20-2004 07:22 PM
Solution: renaming multiple files with spaces HawkeyeCoug Linux - Newbie 0 03-26-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration