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
How do I rename a bunch of files at once? bbbngowc UNIX for Dummies Questions & Answers 8 04-21-2008 09:23 AM
Renaming Files abch624 UNIX for Dummies Questions & Answers 2 03-20-2008 12:35 AM
renaming files jxh461 UNIX for Dummies Questions & Answers 1 02-04-2008 09:32 PM
Renaming files cedrichiu Shell Programming and Scripting 3 04-06-2007 04:35 AM
grep'ing for text within a bunch of files...? kitykity UNIX for Dummies Questions & Answers 1 09-19-2000 08:50 AM

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 09-20-2005
Prashanth.m Prashanth.m is offline
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
  #2 (permalink)  
Old 09-20-2005
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,211
This looks suspiciously like homework to me, however if you search you will find some useful information.
  #3 (permalink)  
Old 09-21-2005
Sabari Nath S Sabari Nath S is offline
Registered User
  
 

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

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

Regards,

SNS
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 06:20 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