Thursday, March 29, 2018

Re: Comparing values of two consequent lines

On 2018-03-29 08:51, tuxic@posteo.de wrote:
> I have a textfile with lot of lines.
> These lines have the following format
>
> <command> a-<name of parameter> <value>
> <command> b-<name of parameter> <value>
[snip]
> I want to check, whether all paired lines have attached
> the same value.

You can find them with

/^command a-\(\w\+\) \+\(\d\+\) *\ncommand b-\1 \+\2\@!

or you can mark them with

:%s/^command a-\(\w\+\) \+\(\d\+\) *\ncommand b-\1 \+\2\@!/& THIS ONE

or indent them with

:g/^command a-\(\w\+\) \+\(\d\+\) *\ncommand b-\1 \+\2\@!/sil .,+>


These assume that "<name of parameter>" can be found by the regex
"\w\+", so modify accordingly if needed.

-tim



--
--
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/d/optout.

No comments:

Post a Comment