Wednesday, July 21, 2010

Re: gvim substitute

thank you all,
Rudy

On Jul 21, 10:58 am, Christian Brabandt <cbli...@256bit.org> wrote:
> Hi rudy_b!
>
> On Mi, 21 Jul 2010, rudy_b wrote:
>
>
>
>
>
>
>
> > Hi all,
> > I would truley thank you if you can help me with my issue. It's been few
> > hours I am trying to solve this, but no luck yet!!
>
> > I want to do a substitution using the (/s) command. But I am ONLY interested
> > in substituting multiples of 100th line.
> > In other words, I have a huge file (thousands of lines); and, I want to go
> > through this file, and look for lines #100, #200, #300, #400, ... and append
> > the word "checked" at the end of these line.
> > for example:
> > 1. this is my line #1
> > 2. this is my line #2
> > 3. this is my line #3
> > ...
> > 100. this is my line #4 (CHECKED)
> > 101. this is my line #101
> > ...
> > 199 this is my line #199
> > 200. this is my line #200 (CHECKED)
> > ...
> > and so on...
>
> > Does anyone know how can I do this?
>
> > I tried to look into substituting with the aid of visual selection. (e.g.
> > :$s/\v) but was not able to do such a selection to select multiples of 100th
> > line.
>
> > thanks for your help in advnace.
>
> You got already different solutions. Here is a different one (though a
> little bit more complicated):
>
> :exe '%s/' join(map(range(100,line('$'),100), '''\%'' . v:val. "l$"'), '\|') '/ (CHECKED)'
>
> (one line)
>
> regards,
> Christian- Hide quoted text -
>
> - Show quoted text -

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

No comments: