Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    143

    Unanswered: 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

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •