Monday, February 17, 2014

Re: finding consecutive lines with specific different words/chars

On Feb 17, 2014, at 12:33 AM, Hagay Spector <hagaysp@gmail.com> wrote:

> Hi!
>
> I'm looking for a way in gvim to find the following CONSECUTIVE lines: (I'm numbering the lines for convenience this is not part of the text)
>
> 1. this is line 1 and these are the trailing chars sdf
> 2. this is line 1 and these are the trailing chars fds
> 3. this is line 1 and these are the trailing chars
> 4. this is line 2 and these are the trailing chars
> 5. this is line 3 and these are the trailing chars asdf
> 6. this is line 3 and these are the trailing chars asdf
> 7. this is line 3 and these are the trailing chars fdaa
> 8. this is line 4 and these are the trailing chars
>
> I want to find in gvim, all the rows that are different from the one above them only in the written "line number". in this example it's: 4, 5, 8

Per your description, only line 4 matches your description. IIUC, something like this should do:
:g/^\(this is line \)\(\d\+\)\(.*\)\n\1\(\2\)\@!\d\+\>\3$/+p

-Arun

>
> a search command is preffered over a vimscript.
>

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: