jmnason
asked on
Unix to Windows CRLF
Hi ya,
I FTP a file from a Unix box to a Windows FTP Sever in binary mode. The line feed character from Unix does not get converted to CRLF in Windows since I am in binary mode. Is there a way in Unix to change the LF to Windows compatable CRLF? I would prefer to use a built in Unix command instead of a third party utility.
Thanks!
I FTP a file from a Unix box to a Windows FTP Sever in binary mode. The line feed character from Unix does not get converted to CRLF in Windows since I am in binary mode. Is there a way in Unix to change the LF to Windows compatable CRLF? I would prefer to use a built in Unix command instead of a third party utility.
Thanks!
ASKER
Thanks Satalink, but I want some command that I can automate my process. I create a XML file in Unix, encrypt it and send the file to the windows FTP server and this is automated.
There are several tools to accomplish that, the most common (and likely to be installed) are
unix2dos <filename>
or
recode lat1..ibmpc <filename>
unix2dos <filename>
or
recode lat1..ibmpc <filename>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is your file will be bad if ftp in ascii mode?
'cause you did not tell us your UNIX flaviour, and unfortunately each has its own program/script/alias/whate ver to do it, I'd sugest a general perl solution:
perl -pe 'BEGIN{ $/="\012"; $\="\015\012"} chomp' unixfile >dosfile
perl -pe 'BEGIN{ $/="\012"; $\="\015\012"} chomp' unixfile >dosfile
Why not just FTP the file in ASCII mode? Much simpler.
>>Why not just FTP the file in ASCII mode?
Because the files will still get displayed incorrectly in Windows applications...
Because the files will still get displayed incorrectly in Windows applications...
>>Why not just FTP the file in ASCII mode?
'cause you never know how "ASCII"-mode is defined in your ftp client *and* ftpd-server, be prepared for surprises ...
'cause you never know how "ASCII"-mode is defined in your ftp client *and* ftpd-server, be prepared for surprises ...
ahoffmann,
Agree with your comments about ftp client/server, *but* if you have a known environment, you know what client/server you operate and will know whether ASCII transfers work as they should.
Agree with your comments about ftp client/server, *but* if you have a known environment, you know what client/server you operate and will know whether ASCII transfers work as they should.
agreed, but if you know all this, then there's no need for this question :-))
:set list show
replace all $ with ^M
:/g/$/s//^M/g
thing that should work