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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rename a lot of files again ajp7701 Shell Programming and Scripting 11 03-31-2008 08:36 PM
rename files help piltrafa UNIX for Dummies Questions & Answers 2 10-04-2007 10:47 AM
rename many files fsmadi SUN Solaris 4 04-30-2007 12:27 PM
How to rename files? CompuTelSystem UNIX for Dummies Questions & Answers 9 05-14-2002 04:28 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-02-2007
hankooknara hankooknara is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 80
trying to rename the files in dir

I have bunch of files in win xp machine with

123456 E15 filename
112333.E20 filename
123412.E11 filename

you get the pic, I mount that xp machine's share into linux and try to do a mass rename to something simpler

E15 filename
E20 filename and so on..

I wrote below thinking that it would work but it does not.. can someone advise?

#!/bin/sh
ls |
egrep "^[0-9][0-9][0-9][0-9][0-9]" |
while read a
do
echo $a
yahoo=`sed 's/^[0-9][0-9][0-9][0-9][0-9][0-9][ .]//gi'`
mv $a $yahoo ; mv $yahoo $a
done
 

Bookmarks

Tags
linux

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 09:53 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