Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- sftp ascii problem
February 4, 2005, 6:48 pm
rate this thread
1) We transfered flat text files from UNIX-1 server to WINDOWS-1
Secure FTP server.
2) As we aware UNIX interprets end of line <LF> (i.e Line Feed)
Windows with <CR><LF> (i.e Carriage REturn and Line Feed)
3) When we tranfered file from UNIX-1 to WINDOWS-1 it added <CR> to
before <LF> and transfered .. When you open this file in windows text
pad, note pad.. it looks fine,
4) It is mandatory that we need to tranfer this file from WINDOWS-1 to
UNIX-2 server(this server outsiders server we don't have any control on
it. We need to send the text file to process this file).
5) It is mandatory that we need to transfer file using SFTP (secure
Ftp) from WINDOWS-1 TO UNIX-2. sftp does not have option to chose
ascii/binary. it transfer as it is.
So file in UNIX has one extra charactaer (^M -- Carraige return) and
that server is not processing this file.
Please let me know if any body know how to remove this extra
characater ^M before sending to UNIX server. As I already mention. we
dont have any control on UNIX-2 server.. we cann't do removal on UNIX-2
Thank in advance for your help
Re: sftp ascii problem
More or less true. Unix doesn't interpret end of line, applications do. In
unix, a file is just a sequence of bytes.
This is an option on some transfer programs, and it can almost certainly be
turned off. For FTP, choosing binary mode will transfer the file without
"converting" newlines by adding CR before each LF.
The easy way would be to never add the CR in the first place. Use a
binary-safe transfer method from UNIX-1 to WINDOWS-1.
If you really want to do this, rather than just never adding the characters to
start with, there are dozens of ways. Cygwin includes dos2unix.exe which will
do what you want.
NOTE that adding CR and then removing them is potentially lossy if the
original file had any CR in it.
Mark Rafn email@example.com <http://www.dagon.net/
- » How to call a remote program through SSH tunnel and pass a local file as parameter?
- — Next thread in » Secure Shell Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — Newest thread in » Secure Shell Forum