Substitute command on vi

Murray Taylor MTaylor at bytecraft.com.au
Sun May 7 23:49:24 UTC 2006


This is a good vi incantation

(NB The ^V is only there to allow you to put in the ^M. The ^V doesnt 
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."
  Albert Einstein 
-- 

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org 
> [mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Denis R.
> Sent: Saturday, 6 May 2006 3:40 AM
> To: magalhj at yahoo.com.br
> Cc: freebsd-questions at freebsd.org
> Subject: re: Substitute command on vi
> 
> Try
> #dos2unix file_name
> 
> >>>>>>>>>>
> Hi list,
> 
> I need to substitute a lot of characters ^M (ctrl+M) at the 
> end of each line in my file.
> 
> The command :%s/^M//g insn't have success.
> 
> How can i do it ?
> 
> Thanks,
> 
> 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. 

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.***


More information about the freebsd-questions mailing list