UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 7th, 2004, 01:34 PM
manuforu manuforu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 manuforu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need to Change File name in Script

I have to ftp 4 files from one server to another.
These files are formatted as zcced.f1.o1.d333.d3333
the only difference with these files is the last four digits.
Once I ftp them I have to take the file with HDr 166 as the begin line and change it to a zcced.f1.ou.d333.d3333.

The other 3 files I will delete.
Can anyone help me on how to change to file name?
Right now I'm using the find command which gets me the file I want but I don't know how to use that info to change to file name.

Reply With Quote
  #2  
Old October 7th, 2004, 11:09 PM
Muthukumar_K Muthukumar_K is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 Muthukumar_K User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to Muthukumar_K
Yes. You can use find command to find the file and use to change the name of filename as,

find <path> -type f -name "filename" -exec cp {} <newfilename> \;

where,

collected file is noted as {}
-exec cp {} <newfilename> \;

will copy the filename. If you want to fully move then use mv command there.

You can use any shell command on -exec <command> <filename> \; there.

HTH.

REgards,
Muthukumar.

Reply With Quote
  #3  
Old October 8th, 2004, 12:41 PM
manuforu manuforu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 manuforu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

It worked great thanks for your help

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Need to Change File name in Script


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway