Carriage return and line feed (Re: [Techtalk] get rid of "^M" in a file)

Lina Mårtensson plastic at dtek.chalmers.se
Fri Jun 17 08:37:40 EST 2005


On Thu, Jun 16, 2005 at 03:25:11PM -0700, maria wrote:
> So the files I have been looking at were actually created on a mac, and 
> seem to only have the ^M.  If I remove the ^M I just get one big glob of 
> text.

In that case, if you want to do it in vim, you do:

:% s/ctrl-v ctrl-m/ctrl-v ctrl-enter/g

When you see this on the vim command line, it will show up like this:

:% s/^M/^M/g

Even though they look the same, this will work and all the ^M's will be
replaced by line feed characters.

	/Lina


More information about the Techtalk mailing list