Monday, February 17, 2014

Re: finding consecutive lines with specific different words/chars

On 17.02.14 00:33, Hagay Spector wrote:

> 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

It's not your preferred method, but in case you need a quick fix now,
"!}uniq -d" shows that line 6 is in fact the only repetition. (The '2'
makes 4 unique, and 7,8 are distinctly different.) Mind you, in a bigger
file, especially with multiple matches, using uniq would be less
appealing, and I'd pipe to a bit of awk.

Alternatively, "!}sort -u" sorts the lines, and removes duplicates. Do
you need to do more than that?

Erik

--
"Isn't it enough to see that a garden is beautiful without having to believe
that there are fairies at the bottom of it too?" - Douglas Adams

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

Post a Comment