Unix Technical Forum

Weird Charcters in an ftp'd file

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 ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2008, 09:50 PM
St. Claire
 
Posts: n/a
Default Weird Charcters in an ftp'd file

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-04-2008, 09:50 PM
Gary R. Hook
 
Posts: n/a
Default Re: Weird Charcters in an ftp'd file

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
__________________________________________________ ______________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-04-2008, 09: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").
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-04-2008, 09:50 PM
Gary R. Hook
 
Posts: n/a
Default Re: Weird Charcters in an ftp'd file

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
__________________________________________________ ______________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com