This is a discussion on Weird Charcters in an ftp'd file within the AIX Operating System forums, part of the Unix Operating Systems category; --> I have several aix files that I ftp down to my pc hard drive. I then burn these files ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? TIA |
| |||
| 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"). -- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE __________________________________________________ ______________________ |
| |||
| 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"). > |
| ||||
| Anne Tuchscherer wrote: > 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. Actually, the ^V will show up as a "^" on the bottom line. Then it gets replaced by the following character as a literal (works with ESC, etc, too). And if you want to do this on the Windoze box to re-burn the CD, download a copy of Vim (www.vim.org). Vi Improved on Windoze and other platforms. Schweeet. Then you can fix the files, recreate the CD and redistribute. -- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE __________________________________________________ ______________________ |