The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Renaming multiple files Jazmania Shell Programming and Scripting 6 01-02-2009 02:16 PM
Renaming multiple files amit4g Shell Programming and Scripting 2 07-14-2008 08:36 AM
Renaming multiple files rmayur UNIX for Dummies Questions & Answers 6 02-26-2004 04:40 AM
Renaming multiple files jxh461 Shell Programming and Scripting 4 04-01-2003 06:25 PM
renaming multiple files piltrafa UNIX for Dummies Questions & Answers 6 11-10-2001 12:27 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-09-2009
kevin9 kevin9 is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 7
renaming multiple files while replacing string

hi,

i've found a few examples of scripts to do this but for some reason can't get them to work properly.

basically i have some dirs with a few hundred files mixed in with a bunch of other files that were made with a typo in part of them.

long-file-names-tyo-example.ext

want to be able to run something through the dir and rename every file with 'tyo' in the file name to the correct 'typo' string

long-file-names-typo-example.ext

any help would be greatly appreciated.
  #2 (permalink)  
Old 05-10-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,524
Code:
for files in *tyo*.ext
do
  mv "$files" "${files/tyo/typo}"
done
  #3 (permalink)  
Old 05-10-2009
kevin9 kevin9 is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 7
thank you very much, this worked great.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0