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 7 01-12-2009 04:27 PM
Removing certain text from multiple filenames Djaunl UNIX for Dummies Questions & Answers 6 01-15-2008 05:52 PM
Renaming of multiple filenames shashi_kiran_v UNIX for Dummies Questions & Answers 7 07-05-2005 09:33 AM
Renaming multiple files rmayur UNIX for Dummies Questions & Answers 6 02-26-2004 04:40 AM
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 07-07-2005
shashi_kiran_v shashi_kiran_v is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 40
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
  #2 (permalink)  
Old 07-07-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
echo 'bas100e18_jun05' | sed 's/.*[A-Za-z]\([0-9][0-9]*\)_.*/\1/'

  #3 (permalink)  
Old 07-08-2005
vibhor_agarwali vibhor_agarwali is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 259
echo bas100e1_jun05 | sed -e 's/bas100e\(.*\)_jun05/Flat\1/g'
  #4 (permalink)  
Old 07-11-2005
shashi_kiran_v shashi_kiran_v is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 40
Thank you guys. Its working fine.
  #5 (permalink)  
Old 07-11-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
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
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 12:26 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