RE: OT: vim question

From: Taylor, Chris David <ChrisDavid.Taylor_at_ingrambarge.com>
Date: Wed, 16 Feb 2011 09:35:03 -0600
Message-ID: <C5533BD628A9524496D63801704AE56D68C9C321C6_at_SPOBMEXC14.adprod.directory>



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

Perfect!

Thanks for all the inputs, but this was the first one I tried this morning and it worked, so I didn't check the other solutions - but all the suggestions were much appreciated!

Chris

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of William Robertson Sent: Wednesday, February 16, 2011 1:38 AM To: 'oracle-l_at_freelists.org'
Subject: Re: OT: vim question

:%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.


[cid:image001.jpg_at_01CBCDBC.CA4CAF00]

Taylor, Chris David<mailto:ChrisDavid.Taylor_at_ingrambarge.com> 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


image001.jpg
Received on Wed Feb 16 2011 - 09:35:03 CST

Original text of this message