RE: incrementing number in each line

2011-04-19 Thread John Beckett
googler wrote: > I have one question related to the solution given there. > :let i=1 | g/foo/s//\="blah_".i/ | let i=i+1 That is two commands: :let i=1 :g/foo/s//\="blah_".i/ | let i=i+1 and the second of these is: :g/foo/ :s//\="blah_".i/ :let i=i+1 :g works by flagging each

Re: incrementing number in each line

2011-04-19 Thread Tim Chase
On 04/18/2011 10:35 PM, googler wrote: :%s/${eco_prefix}_net_\(\d\d\d\) -new_cell_name ${eco_prefix}_\zs\d\d\d/\1 This is what I actually used after posting the question. But I was wondering if there is a better way. In this case, I had already changed the first numbers manually, so I could

Re: incrementing number in each line

2011-04-19 Thread Tony Mechelynck
On 19/04/11 10:24, googler wrote: On Apr 18, 9:50 pm, "John Beckett" wrote: googler wrote: This is what I actually used after posting the question. But I was wondering if there is a better way. Use Tim's approach but modify the replacement using: http://vim.wikia.com/wiki/Substitute_with_

Re: incrementing number in each line

2011-04-19 Thread googler
On Apr 18, 9:50 pm, "John Beckett" wrote: > googler wrote: > > This is what I actually used after posting the question. But > > I was wondering if there is a better way. > > Use Tim's approach but modify the replacement using: > > http://vim.wikia.com/wiki/Substitute_with_incrementing_numbers >

RE: incrementing number in each line

2011-04-18 Thread John Beckett
googler wrote: > This is what I actually used after posting the question. But > I was wondering if there is a better way. Use Tim's approach but modify the replacement using: http://vim.wikia.com/wiki/Substitute_with_incrementing_numbers John -- You received this message from the "vim_use" mai

Re: incrementing number in each line

2011-04-18 Thread googler
On Apr 18, 8:23 pm, Tim Chase wrote: > On 04/18/2011 09:50 PM, googler wrote: > > > I have a few lines as below. Most of the lines below correspond to a > > number (starting from 001 and counting upward). I want to change the > > part "-new_cell_name ${eco_prefix}_001 " in each line to its > > c

Re: incrementing number in each line

2011-04-18 Thread Tim Chase
On 04/18/2011 09:50 PM, googler wrote: I have a few lines as below. Most of the lines below correspond to a number (starting from 001 and counting upward). I want to change the part "-new_cell_name ${eco_prefix}_001 " in each line to its corresponding number without having to go to each line and

Re: incrementing number in each line

2011-04-18 Thread Tony Mechelynck
On 19/04/11 04:50, googler wrote: Hi, I have a few lines as below. Most of the lines below correspond to a number (starting from 001 and counting upward). I want to change the part "-new_cell_name ${eco_prefix}_001 " in each line to its corresponding number without having to go to each line and

incrementing number in each line

2011-04-18 Thread googler
Hi, I have a few lines as below. Most of the lines below correspond to a number (starting from 001 and counting upward). I want to change the part "-new_cell_name ${eco_prefix}_001 " in each line to its corresponding number without having to go to each line and type it (which I did for "-new_net_n