Page 1 of 1

Working with multiple files Find, increment +1, replace

Posted: Fri Mar 28, 2008 7:16 pm
by garymca
Dear forum,

26 identical files (file1.txt - file26.txt) Same word in eack file "example00"

How to change the word in each file to a different value for each file?

file#1 example00 to example01
file#2 example00 to example02
file#3 example00 to example03
.
.
.
all in one pass :?

Posted: Mon Mar 31, 2008 5:30 pm
by talleyrand
The short of it, you can't do it.

You might be able to get close with \i as your replacement which will allow it to count what replacement it is on. It won't take a formatting operation though so you wouldn't get the preceding 0 and if numbering doesn't start at 1 then you'd have to do a special case of 0.

It doesn't sound like that applies here but for future users searching the boards, if you are attempting to address columns of an array 0-x, be aware that you'd need to hand code the 0 and \i would catch the 1-x case.