how do i get rid of this annoying character ^M using vi, in pico i used the
arguments '-w'
but what about in vi?
Those are extra carriage return characters generally displayed
as CR or ^M or \r depending on which programmers convention is
being used.
There are lots of ways to strip then
On Sunday 25 January 2004 01:43 am, marlon corleone wrote:
how do i get rid of this annoying character ^M using vi, in pico i
used the arguments '-w'
but what about in vi?
starting on the 1st line type
:.,$s/ctrlvctrlm//
The .,$ tells it to process from the current line to the last one.
Looks like your file might have been edited in a dos text editor. You
can try running dos2unix against it to see if that helps.
marlon corleone wrote:
how do i get rid of this annoying character ^M using vi, in pico i
used the arguments '-w'
but what about in vi?
cheers
Kent Stewart [EMAIL PROTECTED] wrote:
On Sunday 25 January 2004 01:43 am, marlon corleone wrote:
how do i get rid of this annoying character ^M using vi, in pico i
used the arguments '-w'
but what about in vi?
starting on the 1st line type
:.,$s/ctrlvctrlm//
The .,$ tells it to process from
On Sun, Jan 25, 2004 at 09:43:21AM +, marlon corleone wrote:
how do i get rid of this annoying character ^M using vi, in pico i used the
arguments '-w'
but what about in vi?
This colon (ed) command works in FreeBSD's included vi's
command mode:
:%s/^M//g
followed by pressing Enter. The
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
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
On Sun, 25 Jan 2004 05:02:51 -0500
Avijit Pathania [EMAIL PROTECTED] wrote:
Looks like your file might have been edited in a dos text editor. You
can try running dos2unix against it to see if that helps.
Looks like a jump to conclusions. I find the same artifact every time I run script
Try:
:1,$sX^V^MX??
Where '^' means 'control', e.g. ^V is control-V, ^M is control-M.
Control-V can be used to enter any non-printable ascii character.
Easy when you know.
Dom
PS. the same magic works outside of VI, with sed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -