Page 1 of 1

dynamic find & replace

Posted: Mon Mar 28, 2005 10:00 pm
by jAQUAN
I have multiple .html files with this link in it:
http://www.mysite.com/<myText>/present.html

I also have a text file with a list of names.

What I want to do is replace <myText> in each document, but I want it to increment through the list of names so that my files each have a different link when done.

So if my text file looked like:
george
phill
greg,


george.htm would have the link:
http://www.mysite.com/george/present.html

while phill.htm would have:
http://www.mysite.com/phill/present.html

and greg.htm would have:
http://www.mysite.com/greg/present.html

please please help, I cant bear the thought of doing this manually over hundreds of files.

Posted: Tue Mar 29, 2005 8:42 am
by Abacre
Hi,

I started to write the answer about using "Cyrlic Replace" but then I
found out that in this case you have to create the file with names
manually.

So we added new feature into the program that can do the job
automatically. It's called "Include File Name into search scope"

What should you do step by step:

Please download the latest version of the program:
http://www.abacre.com/download/afrexe.zip

This is only updated EXE file. You need to extract executable file from
zip archive into folder where the program is installed. So you will
replace old executable file by this new one.

Start the program.

Go to main menu - Action - Options - Batch Replace:
check ON: "Include File Name into search scope"
Press OK.

Go to Batch replace tab of the main window.
Check ON: "Use regular expressions".

Put into "Search for":
.*\\(\w+)\.htm\r\n(.+http://www.mysite.com/)<myText>/present.html

and into Replace with:
\r\n$2/$1/present.html

Press Execute button. The program will do the job.
Tell me does it work?

Note, always backup files before replacements.

Regards,
Roman


==============================
Hi,

We call it "Cyclic Replace From File"
Read more:
http://www.abacre.com/afr/manual/operreplace.htm

So what should you do:
Go to Replace tab, select "Cyclic Replace From File" action.
Set Search for:
<myText>/present.html

Replace with:
c:\files\file.txt

(where c:\files\file.txt is correct path to your file name with the list of names).

Our questions:
In each file do you have only one occurrence of the link?
http://www.mysite.com/<myText>/present.html