[Gllug] vi question

Dave Cridland dave at cridland.net
Thu Aug 29 19:45:37 UTC 2002


On Thu, 2002-08-29 at 20:16, Pavel Bradut Boghita wrote:
> Hello list, 
> 
> I tend to use mainly vi for editing text, altough I am just about touching 
> its surface in terms of being able to use it well.
> While editing a html file, I've noticed that at the end of each line appears 
> a "^M" (without the inverted commas). I've inserted a very long line without 
> the "^M" at the end of the line and it made no difference. My browser still 
> displayed the page as normal,  wrapping the text as imposed by the its 
> window size.
> 
> Does anyone know what is the role of this "^M" if any ?

^M is Control-M which is Carriage Return.

You're editing a DOS file, basically. Doing:

perl -e 'while(<>) { s/\r//g; print; }' <some-dos-file >some-unix-file

will translate the DOS line terminated "some-dos-file" into the UNIX
line terminated "some-unix-file".

Or just download them in ASCII mode via FTP, since that's what ASCII
mode is for - changing line termination. (Okay, it'll also convert EBDIC
to ASCII for transmission over the wire, too.)

Dave.


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list