To use textsend, first use send to specify which file
you want to send:
Then enter the textsend command, specifying an "end of record"
or "end of line" character(s):
Everything in the file up to but not including the specified characters are sent to the remote system. Then sending is suspended until another textsend command is given.
Choose an appropriate "end of record" or "end of line" character or string of characters that occur within the file. For record-oriented files, this might be the character(s) that appear at the end of each record. For "regular" text files, this might be the end-of-line characters control-M, control-J, or control-M + control-J.
In practice, you'll probably want to use goto to create a loop in your script file so that the textsend command is entered repeatedly until the end of the file is reached. Following is a small sample script file to send a text file with lines that end with control-M + control-J.
Since textsend does not
transmit the "end of line" characters, we need to make sure line endings
are transferred. We use the say command
to transmit the control-M character immediately after each textsend.
The net result is that we convert the native line ending of the file (control-M
+ control-J, or carriage return + linefeed) to control-M alone.
send myfile.txt ; select file to send loop: textsend "^M^J" ; send part of file up to ^M^J line ending if err0 = 228 goto done ; error 228 = end of file say "^M" ; send carriage return line ending goto loop ; done with one line, repeat until file end done: ... ; file transfer complete