Task, I need to search and replace in a file (2 actually) using a series of values that I will have in a delimited file stored as Old,New format.
I have this script that will read a file, parse and return the old and new values as variables.
Code: Select all
@Echo Off
setlocal enabledelayedexpansion
For /f "tokens=1,2* delims=,;" %%a In (FromTo.txt) Do (
Echo #1Old: %%a
Echo #2New: %%b
)
endlocal
Input
Code: Select all
xxxxx,yyyyy
aaaa,bbbb
Ouput shown below
Code: Select all
#1Old: xxxxx
#2New: yyyyy
#1Old: aaaa
#2New: bbbb
What I now need is a nested call to read another file (or 2 but I have no issues running another script for the second file. If both can be included all the better) and use the 2 variables as Search/Replace values.
I spend most of yesterday searching and in quite a few instances I see hardcoded values of the S/R terms but was unsuccessful with this scenario of passing variables in.
I also do now know what else to add to my search terms to be more specific as they describe what I need to do.
Thanks in advance for any and all help
Greg