The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do I rename a bunch of files at once? bbbngowc UNIX for Dummies Questions & Answers 8 04-21-2008 06:23 AM
Renaming Files abch624 UNIX for Dummies Questions & Answers 2 03-19-2008 09:35 PM
renaming files jxh461 UNIX for Dummies Questions & Answers 1 02-04-2008 06:32 PM
Renaming files cedrichiu Shell Programming and Scripting 3 04-06-2007 01:35 AM
grep'ing for text within a bunch of files...? kitykity UNIX for Dummies Questions & Answers 1 09-19-2000 05:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-20-2005
Registered User
 

Join Date: Sep 2005
Posts: 1
Renaming a bunch of files

Hi Can any body help me reg. this problem? The problem is

the format of the shell script should be
>renam old new
rename: it renames all files in current directory from old extension to new extension
old: it is the old extension of file name (including the '.' )
new: its the new extension

eg: renam .htm .html

it converts all files from .htm to .html extension

eg: renam .txt -txt

it converts all files from .txt to -txt
like .. if a file name was zz.txt it should become zz-txt


Please help me regarding this problem

Thank you
bye
Prash
Reply With Quote
Forum Sponsor
  #2  
Old 09-20-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
This looks suspiciously like homework to me, however if you search you will find some useful information.
Reply With Quote
  #3  
Old 09-20-2005
Registered User
 

Join Date: Jul 2005
Location: Chennai
Posts: 39
xargs comes to ur rescue .... try something like this ....

ls *.htm | xargs -i basename {} ksh | xargs -i -p -t mv {}htm {}html

Regards,

SNS
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0