Re: OT: vim question

From: William Robertson <william_at_williamrobertson.net>
Date: Wed, 16 Feb 2011 07:38:14 +0000
Message-ID: <4D5B7EE6.3020305_at_williamrobertson.net>



  
    
    
  
  
    :%s/[0-9]/^M&/g

places a newline before every digit.

:%s/[0-9]\{1,\}/^M&/g

places a newline before every occurrence of one or more digits.

 



Taylor, Chris David
15 February 2011 21:30

Ok I can’t find it…

 

Where you’re doing a search & replace, how do you keep from replacing the characters you’re searching for:

 

I want this:

 

:1,$s/[0-9]/^M/  --- but this replaces whatever matches in 0-9 with a carriage return – I actually want it to not replace but insert a carriage return after finding the number string and keep the number.

 

Chris



--
http://www.freelists.org/webpage/oracle-l


compose-unknown-contact.jpg
Received on Wed Feb 16 2011 - 01:38:14 CST

Original text of this message