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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 10:45 AM
scripts please rrdore SUN Solaris 2 12-07-2006 02:35 AM
use of ssh in scripts esham Shell Programming and Scripting 7 11-16-2005 08:27 AM
Help with GDL to SQL scripts ch4r1e5 Shell Programming and Scripting 0 10-31-2005 02:51 PM
using su in scripts uchachra UNIX for Dummies Questions & Answers 3 03-11-2002 10:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #22  
Old 11-30-2007
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
ok - here's a sample format of the file that specifies what you're 'get'-ing where it supposed to go:

listOfFile.txt:
Code:
/sourceDirPath1/sourceFileName1 /destinationDirPath1
/sourceDirPath1/sourceFileName2 /destinationDirPath1
/sourceDirPath2/sourceFileName1 /destinationDirPath2
/sourceDirPath3/sourceFileName1 /destinationDirPath3
Here's the modifed code:
Code:
#!/bin/ksh

listOfFiles='listOfFile.txt'

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
$(sed 's#^\([^ ][^ ]*\)/\([^ ][^ ]*\) \(.*\)#get \1/\2 \3/\2#' ${listOfFiles})
bye
EOF
I'll let you work on the format of your 'listOfFiles' file and the corresponding changes to the script, but the above should give you enough of the 'hint' of the general idea.
Good luck!
Reply With Quote
Forum Sponsor
  #23  
Old 12-05-2007
Registered User
 

Join Date: May 2006
Posts: 63
i have a same situation , i somehow manged to read from a file and getting the files and source to target ..

After that , i need to replace few characeters in each file ,

can i have a hint how can i login to that directory , using param.txt in the target server

Thankyou!!
Reply With Quote
  #24  
Old 12-05-2007
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
#!/bin/ksh

for file in $(< ${listOfFiles} )
do
     ex - ${file} <<EOF
%s/foo/bar/g
wq!
EOF
done
Reply With Quote
  #25  
Old 12-06-2007
Registered User
 

Join Date: May 2006
Posts: 63
Quote:
Originally Posted by vgersh99 View Post
Code:
#!/bin/ksh

for file in $(< ${listOfFiles} )
do
     ex - ${file} <<EOF
%s/foo/bar/g
wq!
EOF
done
Hi

Thanks for your help , when i use the logic , script is in Hung Mode and when also it is not loggin in to that directory , please correct me if i am wrong

Thanks
Reply With Quote
  #26  
Old 12-06-2007
Registered User
 

Join Date: Dec 2005
Posts: 74
If you dont need
mget *
to prompt you for your answer, u can use "-i" option with ftp

Rakesh UV
Reply With Quote
  #27  
Old 12-06-2007
Registered User
 

Join Date: May 2006
Posts: 63
Quote:
Originally Posted by vgersh99 View Post
Code:
#!/bin/ksh

for file in $(< ${listOfFiles} )
do
     ex - ${file} <<EOF
%s/foo/bar/g
wq!
EOF
done

Thanks , but i am not sure of this one .. when i give the following in my script

example :
listOfFiles has

Unix (which is a directory ) and it has to login to that directory , by reading
the param file but the script is getting hung

am i doing something wrong , please let me know

Thanks
Reply With Quote
  #28  
Old 12-07-2007
Registered User
 

Join Date: May 2006
Posts: 63
Thanks , i have completed it by using While Loop

Thanks Guys
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:16 AM.


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

Content Relevant URLs by vBSEO 3.2.0