Please help in writing a script to replace multiple words in a text file
I have several configuration files (over 40) and I need to replace multiple categories with the updated categories. I have a csv file with one column containing the old categories and another column containing the new categories.
Ideally, I would like for the script to reference the csv file and be able to automatically run through all config files.
I have a very basic script that will replace one word with another word, but I have not been able to expand it beyond that.
This is the script I have;
Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\Scripts\Text.txt", ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, "Old", "New") strNewText1 = Replace(strNewText, "Day", "Night") strNewText2 = Replace(strNewText1, "1", "2") Set objFile = objFSO.OpenTextFile("C:\Scripts\Text.txt", ForWriting) objFile.WriteLine strNewText2 objFile.Close