I am trying to find out how to search a text file for particular values and then delete or replace them. The values are themselves in a text file.
As an example, lets say I have a text file called 'Data.txt' which contains the following plain text:
"An Aardvark saw a Bat, then told a Cat who told a Dog, who wrote it down for the Elephant"
and a second text file called 'Variables.txt' which contains the following list:
...and I want to script something that will read the first line of Variables.txt (i.e. Aardvark) and look for it in 'Data.txt'. If it finds it in Data.txt it needs to be deleted or replaced with a different value
I then want the script to loop so that it repeats for all values in 'Variables.txt'
I hope the above makes sense.
I'm fairly okay on writing batch files, but can't get my head around the For /F command etc.
It seems to me that I need a loop within a loop - i.e. loop 1 reads the entire data.txt file looking for the variable on line 1 of Variables.txt (i.e. 'Aardvark') and once data.txt has been checked for the first variable ('Aardvark') is then looped to check again but this time for the second variable (i.e. 'Bat').
I hope the above makes sense!