Wednesday, December 23, 2020

Re: Substitute pattern over multiple lines


On Wed, Dec 23, 2020 at 9:04 PM George Dinwiddie <lists@idiacomputing.com> wrote:
Why not use

:%s/\n3 CONC //

to concatenate all the continuations and then use

:%s/\(2 NOTE \)\(.*\)/\1<div> class="xxx">\2<\/div>/

to turn all the NOTE lines into <div> blocks? Or am I misunderstanding
something about the transformation you need?

  - George

 One big problem with the first part is that I *only* want to concatenate the continuation lines when they appear immediately following a "2 NOTE..." tag, AND that "2 NOTE" tag must be either the next or next but one line after "2 TYPE tngnote". 
 
 I neglected to make it clear earlier that I need to first search on  "2 TYPE tngnote" since there are other "2 TYPE" tags where I don't want to change anything.

 John 

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGZBEdQR%2B2FtPG%3D%2B%3DNUWtDXCwgAXgBK764J-71VdKj_1tJ-imQ%40mail.gmail.com.

No comments: