Chaning one script line of many files

G

Guest

I am working on an important project involving hundreds of html files, having
exactily the same data except for one part of one line. This is a tow-digit
number on the line for the name of an image. I was wonderinig if it is
possible to simultaneously change this data in all the files ascending or
decending so the task isn't so tedious editing each one individually.
Any and all help is desired.
Thanks, Arthur
 
P

Pegasus \(MVP\)

smartA said:
I am working on an important project involving hundreds of html files, having
exactily the same data except for one part of one line. This is a tow-digit
number on the line for the name of an image. I was wonderinig if it is
possible to simultaneously change this data in all the files ascending or
decending so the task isn't so tedious editing each one individually.
Any and all help is desired.
Thanks, Arthur

Your best bet is a "Search and Replace" command line tool. I typed
this into the Google search field and got thousands of links:

"Search and Replace" "command line" free
 
G

Guest

The programs I saw only changed the data to the same thing. However, I am
only interested in a program that can replace a piece of data in many files
with an increased number for each subsequent file - each one goes up one
number as it proccesses the files, if they are all the same.
Thanks
Arthur
 
P

Pegasus \(MVP\)

Let's have an actual example, please!


smartA said:
The programs I saw only changed the data to the same thing. However, I am
only interested in a program that can replace a piece of data in many files
with an increased number for each subsequent file - each one goes up one
number as it proccesses the files, if they are all the same.
Thanks
Arthur
 
G

Guest

For example:
the line in the first html file is:
<img src="../../DiskOne/IM_A0001.JPG"></a>
the second file:
<img src="../../DiskOne/IM_A0002.JPG"></a>
the third:
<img src="../../DiskOne/IM_A0003.JPG"></a>
and so on...
 
P

Pegasus \(MVP\)

You would have to use a combination of batch
commands and "search and replace". Assuming
that bkreplacem.exe (as suggested by Dog) is
your search and replace tool, you could do this:

@echo off
cd /d "c:\Documents and Settings\My Pics"
set counter=0
for %%a in (*.jpg) do call :Sub %%a
goto :eof

:Sub
set /a counter=%counter% + 1
bkreplacem "%1" ... ... ...

What parameters you exactly place into the search and
replace command I do not know, because your example
is insufficiently detailed: It does not tell us what string
you're looking for, and it does not tell us what you want
to replace it with. It simply mentions an incrementing
counter, and this is exactly what the above batch file
gives you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top