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 a file VeloLisa Shell Programming and Scripting 6 04-16-2009 06:24 AM
file renaming larne Shell Programming and Scripting 7 10-14-2008 06:49 AM
Help in renaming file !!! kumarsaravana_s UNIX for Dummies Questions & Answers 5 05-02-2007 01:45 PM
Renaming a file name dbrundrett Shell Programming and Scripting 2 01-06-2004 10:36 AM
Renaming a file to the same name lachino8 UNIX for Dummies Questions & Answers 3 07-31-2002 09:52 AM

Reply
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 08-24-2009
vasanth_vadalur vasanth_vadalur is offline
Registered User
  
 

Join Date: Jun 2009
Location: bangalore, INdia
Posts: 23
Is there anyway for file renaming in csh

Hi,

I have the files like in a directory.

filerefcellhg1.txt
filerefcellhg2.txt
filerefcellhg3.txt
filerefcellhg4.txt
filerefcellhg5.txt
filerefcellhg6.txt
filedonotchange.txt
filedonot

Desired output:

filerefhg1.txt
filereflhg2.txt
filerefhg3.txt
filerefhg4.txt
filerefhg5.txt
filerefhg6.txt
filedonotchange.txt
filedonot

Here i want to delete the "cell" and rename it.

Thanks in advance,
VAsanth

---------- Post updated at 12:02 PM ---------- Previous update was at 11:51 AM ----------

Thanks in advance

Vasanth
  #2 (permalink)  
Old 08-24-2009
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Code:
foreach file (*cell*)
  mv $file `echo $file | sed 's/cell//'`
end
Note that this will remove the string 'cell' from any filename it finds in the directory.
Reply

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 12:34 PM.


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