The 'man page' is a bit vague:
ascii Set the file transfer type to network ASCII. This is the default
type.
binary Set the file transfer type to support binary image transfer.
however, we know that if you were to translate characters in executable
files that could be interpreted as line termination characters were the file
text, you end up with a corrupt executable.
Binary is for transferring executable images (and any other data that you
don't want messed with).
ASCII mode transfers as 'network ASCII' which means it is translated to the
appropriate format by the recipient, in the spirit of 'htonl()' and
'ntohl()'.
I tested my understanding this morning. I transferred a text file called
SQL.LOG to a Unix machine.
On the Windows machine the file size is 18829 bytes.
In binary mode the file transferred as: 18829 May 25 09:05 SQL.LOG
In ASCII mode the file transferred as: 18333 May 25 09:06 SQL.LOG
ASCII mode transfer cause the file size to be smaller on the Unix box.
In Unix the EOL character is 0x0A
In Windows it is a two byte sequence 0x0A, 0x0D
The file transferred in ASCII mode is one byte smaller for every newline
encountered.
Maybe we are not seeing the forest for the trees though.
Maybe, since the 'man page' says ASCII is the default, and the translation
*should* have taken place, there is another problem that is not simply
newline translation...
Eh?
Greg
-----Original Message-----
From: Stephen P. Potter [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 25, 2001 8:45 AM
To: baby lakshmi
Cc: [EMAIL PROTECTED]
Subject: Re: reg ftp
Lightning flashed, thunder crashed and "baby lakshmi"
<[EMAIL PROTECTED]
> whispered:
| hi
| while doing ftp from windows to unix, the file contains ctl M at the end
of
| each line. my file is a huge data file. i am not able to delete that. is
| there any better way to delete it.
| If anyone can answer this, it wud be helpful to me.
I don't understand your question. Are you saying you can't delete the ^M?
First thing to do is to transfer your files correctly, using bin(ary)
mode. That will do proper EOL translation for you. As far as fixing it
with perl, try something like
perl -pi.bak -e 's/\cM$//' [ filename ]
This will create a backup file (called filename.bak) and a fixed file
without the ^Ms.
-spp