Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jan 2004 10:33:08 -0700
From:      Eric Dyer <blackice@darksoulz.net>
To:        freebsd-questions@freebsd.org, misc@openbsd.org
Subject:   Re: how to get rid of ^M character using vi
Message-ID:  <6.0.1.1.2.20040125103200.026dbce0@osiris.darksoulz.net>
In-Reply-To: <20040125162723.GQ672@griffon>
References:  <BAY13-F62bUpm0RnzXo00012ad5@hotmail.com> <20040125151753.GA1798@gandalf.welch.net> <20040125162723.GQ672@griffon>

next in thread | previous in thread | raw e-mail | index | archive | help
One thing that works from the command line too

col -bx < oldfile > newfile && mv newfile oldfile

Picked that up from a freebsd box that had a freebsd-tips or something like 
that fortune file running on login

At 09:27 AM 1/25/2004, Greg Wooledge wrote:
>If *every* line ends with ^M (which is almost always going to be the
>case, if the file has been produced on a DOS/Windows system), then
>you can just use this:
>
>:%s/.$//
>
>to delete the last character of each line.  This has an obvious
>downside, but the advantages are that it's easier to type and to
>read.
>
>--
>Greg Wooledge                  |   "Truth belongs to everybody."
>greg@wooledge.org              |    - The Red Hot Chili Peppers
>http://wooledge.org/~greg/     |
>
>[demime 0.98d removed an attachment of type application/pgp-signature 
>which had a name of signature.asc]




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