View Single Post
  #6  
Old 03-19-2012, 10:43 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Quote:
but I can't do cat on the remote file since the file need to append is on my local machine which is XP.
Would echo work?

You'll read in the file locally, but finding the easiest solution on the remote is the question. If you really only ever needed to replace () with (public) then the sed command might be enough. It sounds like you really need to append data. If you were to read in a line of data from the local file, then you could issue a command to echo that data and append it to the file.

The following section of code (from the SecureCRT Scripting Manual, pp. 92-93), shows how you would send data to the remote:

Code:
' Send each command to the remote system.
For Each strCommand in vCommands
' Exit the For..Next loop if our current command is empty... ' otherwise, we'll just be pressing the Enter key pointlessly. If Trim(strCommand) = "" Then Exit For crt.Screen.Send strCommand & vbcr ' Wait for the command to complete before moving on to ' the next command crt.Screen.WaitForString strPrompt
Next
If you can use "echo" to append data then I think you would could modify the strCommand variable to be something something like this:
Code:
'... Same code as snippet above crt.Screen.Send "echo " strCommand & " >> " & "file.txt" && vbcr ' Wait for the command to complete before moving on to ' the next command crt.Screen.WaitForString strPrompt
Next
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote