If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > ftping a file and then doing a find and replace

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-08, 19:27
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
ftping a file and then doing a find and replace

I have a file on my windows XP PC for which I wrote a script to ftp it to a unix server(Sun 5.8).
I am looking to do a find and replace(all within my script) of a string in unix and then ftp it back to the windows.

This is what I have so far :
test_ftp.bat contents are :
###
C:
cd schema_compare
ftp -s:test_ftp.txt servername
###

test_ftp.txt contents are :
###
username
password
put TEST.txt
perl -e "s/myname/yourname/g;" -pi $(find TEST.txt)
get TEST.txt
bye
###

The file gets FTPed, and then I get the error:
ftp> perl -e "s/myname/yourname/g;" -pi $(find TEST.txt)
Invalid command.

Obviously, I cannot do A perl command in ftp prompt.
Does anyone have any idea as to how I can achieve what I am trying to do above ?
Thanks
Reply With Quote
  #2 (permalink)  
Old 02-29-08, 13:41
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Talking

Try puting a ! (exclamation point) in front of the perl statement:

Code:
### test_ftp.txt contents are :
###
username
password
put TEST.txt
!perl -e "s/myname/yourname/g;" -pi $(find TEST.txt)
get TEST.txt
bye
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On