Simple Text/Hyperlink/Code Token Replacer + Remover.
I need a very small program (possibly only 25 lines of code) written in PERL that will simply replace tokens in multiple files within a folder, with consecutive lines or paragraphs of text/code/hyperlinks from a txt file (with a loop that will allow me to add multiple hyperlinks/txt to each file as well.
And also the ability to remove those same lines of hyperlinks/txt if needed, by comparing text from the original source txt file and if it matches, remove it
E.g. I may need to place 1500 different hypelinks into 1000 web pages - one or more on each page. The hyperlink will be stored in a txt file.
Or, I may need to place 1500 different paragraphs of info into 1000 web pages, etc
I am including a graphic of generally what I am looking for but only to show how it might work, I am not particularly fussed about how it looks.
A program where :-
1st - I specify a folder with multiple (say 2000) html, php or txt files
2nd - I specify what type of file to process - e.g. html, php or txt
3rd - I specify the source file holding my hyperlinks/code/text - one per line or paragraph - till the next return.
4th Radio buttons that determine, either that, the hyperlinks are to be added to the files by replacing the token OR? if 'Delete Matching Code' is selected the hyperlinks are to be removed from the files if they match a hyperlink in the source file.
5th If the hyperlinks are to be added, I need a field to type in a token that the program will search and replace
6th A START and a CANCEL button
7th A record counter of how many files have been processed of the files in that folder.