Batch replace functionality in a text file

cirrrocco

Golden Member
Sep 7, 2004
1,952
78
91
I dont know if there is a standard utility to do the following.

Lets suppose I have a page open and am linking to 20 different pages or links.
ex:

<a href = link1.html>
<a href = link2.html>
.
.


Now I have a text file that has the following
txtlink1
txtlink2
.
.
.

Is it possible for me based on a certain identifier to replace link1 with txtlink1 and link2 with txtlink2


Oh and by the way, just to make it easier, maybe "link1" and "link" could be s specific string like "?????". so if I have 10 instances of "?????" in my file, and I have ten lines of text in the other file. Then line 1 from second file should replace the first instance of "?????" in file1 and second line should replace second instance of "?????" and so forth..Thanks :)
 

thegisguy

Senior member
Jan 15, 2008
292
0
0
Probably should have gone in windows software, but anyways.

There are probably better ways to do what you want but they way I do it is this. Open all the files in a text editor that allows for multiple files open in one session, my fav is NoteTab light. Notetab light then allows you to do a find and replace for the text, but with the option to search all documents. Click that box, and then replace all, and every occurrence is changed. Then close notetab and it will prompt you to save changes. Say yes to all, and your done.

Like I said there are probably better ways but this gets the job done.
 

cirrrocco

Golden Member
Sep 7, 2004
1,952
78
91
Hey there, thanks for the response. I did not want to change an unique identifier in a bunch of files, but rather change the unique identifier in ONE file with the contents of a second file. so if i have ten instances of a unique identier say "****HHH***" in the first file, then lets suppose i have 10 different words each on a separate line. the first word from file 2 should replace the first instance of ****HHH*** in file 1 and the word on the second line should replace the second instance of ****HHH*** in file 1 and so forth.

ex:
COntents of file 1

ABCD = ABCD + ****HHH***
href=fox****HHH***.html
why does ****HHH*** fly high??

contents of second file

EFG
sucks
the bird

========
so after operation the content of file 1 should be

ABCD = ABCD + EFG
href=foxsucks.html
why does the bird fly high??


I hope that made sense.
 

thegisguy

Senior member
Jan 15, 2008
292
0
0
I agree with mpilchfamily, I'm guessing you're going to need to code something. It could be easily done in Perl. Sorry about the earlier post, I misunderstood what you wanted.
 

ASK THE COMMUNITY