The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

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
trying to rename the files in dir hankooknara Shell Programming and Scripting 8 07-02-2007 04:36 AM
How to rename files? CompuTelSystem UNIX for Dummies Questions & Answers 9 05-14-2002 04:28 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 04-30-2007
fsmadi fsmadi is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 8
rename many files

how to rename many files with one command

package_cypdba.acapx_p.sql
package_cypdba.ccapx_p.sql
package_cypdba.bcapx_p.sql


these to be renamed as
acapx_p.sql
ccapx_p.sql
bcapx_p.sql

thanx
  #2 (permalink)  
Old 04-30-2007
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Renaming the File List

Assuming the list of file are saved into the file /tmp/FileList and you run this code from the directory on which the files resides.


Code:
for v in $(</tmp/FileList) ; do
 cp $v ${v#*.}
done

Please let us know if this doesn't work.

Thanks
Nagarajan Ganesan.
  #3 (permalink)  
Old 04-30-2007
murad.jaber murad.jaber is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 51
dears
it not worked i want to replace many files by removing the first words

package_cypdba.acvcd_p.sql
with the new name
acvcd_p.sql
  #4 (permalink)  
Old 04-30-2007
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Quote:
Originally Posted by ennstate
Assuming the list of file are saved into the file /tmp/FileList and you run this code from the directory on which the files resides.


Code:
for v in $(</tmp/FileList) ; do
 cp $v ${v#*.}
done

Please let us know if this doesn't work.

Thanks
Nagarajan Ganesan.
The syntax " cp $v ${v#*.}" is that of korn shell.

You can try,


Code:
for v in `cat /tmp/FileList`; do
cp -i $v $(echo $v| cut -d"." -f2- )
done

You can either use it in a script or enter the logic from the command prompt.

Thanks
  #5 (permalink)  
Old 04-30-2007
murad.jaber murad.jaber is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 51
also i try the output by adding h aftre _p for example

package_body_paldba.abalq_p.sql i need to copy it to abalq_ph.sql

in first step i do the above script but it make ablaq_p.sql and i need to add in every file h after _p
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 09:37 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