Skip site navigation (1)Skip section navigation (2)
Date:      27 Aug 2004 22:52:04 -0400
From:      Mike Jeays <Mike.Jeays@rogers.com>
To:        f-questions <freebsd-questions@freebsd.org>
Cc:        Soo-Hyun Choi <shchoi@gmail.com>
Subject:   Re: vi editor related question
Message-ID:  <1093661524.743.111.camel@chaucer>
In-Reply-To: <20040828004618.GA2856@moo.holy.cow>
References:  <34b425c50408271652314776b1@mail.gmail.com> <20040828004618.GA2856@moo.holy.cow>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2004-08-27 at 20:46, Parv wrote:
> in message <34b425c50408271652314776b1@mail.gmail.com>, wrote
> Soo-Hyun Choi thusly...
> >
> > I edit ... certain text editor under Windows XP, and then I open
> > ... using vi editor under FreeBSD. Then, there are bunch of "^M"
> > sign at the end of each line. Does anyone know why this is
> > happening?
> 
> Cause is the default line ending on Windows being different than on
> Unix/FreeBSD.
> 
> 
> > And, does anyone can tell me how to avoid this kind of things?
> 
> Use an editor on Windows that saves the file as w/ Unix line ending.
> Or, use an editor on FreeBSD, like vim 6 from the ports, that will
> hide/change '^M' characters.
> 
> Other methods is to preprocess your files...
> 
>   http://groups.google.com/groups?q=remove+%5EM+file
>   http://groups.google.com/groups?q=remove+%5EM+group%3Acomp.*
> 
> 
> 
>   - Parv

If you are using plain vi, you can get rid of the unwanted characters
with the command
:1,$s/ctrl-v-m//g where "ctrl-v-m' means hold down the Ctrl key while
you press v followed by m.  You will see them magically disappear.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1093661524.743.111.camel>