Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 May 2006 09:49:10 +1000
From:      "Murray Taylor" <MTaylor@bytecraft.com.au>
To:        "Denis R." <darom@filmkern.com>, <magalhj@yahoo.com.br>
Cc:        freebsd-questions@freebsd.org
Subject:   RE: Substitute command on vi
Message-ID:  <04E232FDCD9FBE43857F7066CAD3C0F117C8BA@svmailmel.bytecraft.internal>

next in thread | raw e-mail | index | archive | help
This is a good vi incantation

(NB The ^V is only there to allow you to put in the ^M. The ^V doesnt=20
show in the final command line, so dont panic that you cant see it)

:g/^V^M/s///g

ie

g/^V^M/   - find a ^M (any one will do, you dont need to be at the file
start)
s///      - substitute nothing for the ^M just found
g         - do this to all other ^M's


mjt
--
"Any intelligent fool can make things bigger and more complex... It
takes a
touch of genius - and a lot of courage to move in the opposite
direction."
=20 Albert Einstein=20
--=20

> -----Original Message-----
> From: owner-freebsd-questions@freebsd.org=20
> [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Denis R.
> Sent: Saturday, 6 May 2006 3:40 AM
> To: magalhj@yahoo.com.br
> Cc: freebsd-questions@freebsd.org
> Subject: re: Substitute command on vi
>=20
> Try
> #dos2unix file_name
>=20
> >>>>>>>>>>
> Hi list,
>=20
> I need to substitute a lot of characters ^M (ctrl+M) at the=20
> end of each line in my file.
>=20
> The command :%s/^M//g insn't have success.
>=20
> How can i do it ?
>=20
> Thanks,
>=20
> Aguiar
---------------------------------------------------------------
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material.=20

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---------------------------------------------------------------

***This Email has been scanned for Viruses by MailMarshal.***



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