View Single Post

   
  #3 (permalink)  
Old 01-04-2008, 10:50 PM
Anne Tuchscherer
 
Posts: n/a
Default Re: Weird Charcters in an ftp'd file

To get rid of the ^M character in the existing files if you don't want
to re-ftp them do the following.

In a vi session for each file type the following
:1,$s/^V^M// (colon one comma dollarsign s slash CTRL-V CTRL-M slash slash)

The CTRL-V won't show on the screen. It is an escape sequence to allow
to type the CTRL-M. This line will replace all the CTRL-M's with nothing.

Anne

Gary R. Hook wrote:

> St. Claire wrote:
>
>> I have several aix files that I ftp down to my pc hard drive. I then
>> burn these files to a cd. I then take the cd and copy the files to
>> another aix system but when I vi these files they all have ^M at the
>> end of each line.
>> I know the difference is between aix and windows filesystems but does
>> anyone have fix for this?

>
>
> Unix uses a newline (^J) to signify a CR/LF pair. DOS/Windoze/other
> systems feel that both a carriage return (^M) and newline (^J) are
> required to indicate an end-of-line. So if you transfer files in
> binary mode between the two systems, no translation of end-of-line
> characters occurs (the file is transmitted as-is).
>
> If you use ftp to move files between systems with the intent of
> still being able to access them on Unix (as you describe) then you
> would want to transfer the files in binary mode. The ftp
> protocol will leave the file alone, and not perform the newline
> translation. The ftp subcommand is "bin" (the corollary is "ascii").
>


Reply With Quote