The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Renaming multiple files jayell Shell Programming and Scripting 5 02-27-2008 12:17 PM
Removing certain text from multiple filenames Djaunl UNIX for Dummies Questions & Answers 6 01-15-2008 01:52 PM
Renaming of multiple filenames shashi_kiran_v UNIX for Dummies Questions & Answers 7 07-05-2005 05:33 AM
Renaming multiple files rmayur UNIX for Dummies Questions & Answers 6 02-26-2004 12:40 AM
renaming multiple files piltrafa UNIX for Dummies Questions & Answers 6 11-10-2001 08:27 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2005
Registered User
 

Join Date: Jun 2005
Posts: 40
Stumble this Post!
Renaming of multiple filenames

Hi All,

I need to rename the multiple file names.

I need to rename for example as follows

bas100e1_jun05 to FLAT1
bas100e2_jun05 to FLAT2
bas100e18_jun05 to FLAT18

Please not that I can cut_jun05 from the filename. Madhan had helped with a similar kind of script. But this is a new requirement.

Thanks
Shash
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-07-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
Stumble this Post!
Code:
echo 'bas100e18_jun05' | sed 's/.*[A-Za-z]\([0-9][0-9]*\)_.*/\1/'
Reply With Quote
  #3 (permalink)  
Old 07-08-2005
Registered User
 

Join Date: Jan 2005
Posts: 212
Stumble this Post!
echo bas100e1_jun05 | sed -e 's/bas100e\(.*\)_jun05/Flat\1/g'
Reply With Quote
  #4 (permalink)  
Old 07-11-2005
Registered User
 

Join Date: Jun 2005
Posts: 40
Stumble this Post!
Thank you guys. Its working fine.
Reply With Quote
  #5 (permalink)  
Old 07-11-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Stumble this Post!
Quote:
Originally Posted by vibhor_agarwali
echo bas100e1_jun05 | sed -e 's/bas100e\(.*\)_jun05/Flat\1/g'
There's no need for the -e if you've only got one expression.

Cheers
ZB
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:57 AM.


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

Content Relevant URLs by vBSEO 3.2.0