Nice! It's starting to work! Thank you very much, Dias!
So the 4-deep nested "FOR" loop proved to take a wee bit too long to process (I had enough time to wait, rethink, and edit the code into something that would work faster before it finished) so I re-worked it to three 2-deep nested loops:
REM Grab the first string in the first file
for /f "eol= tokens=1 delims=" %%a in (c:\fr1a.txt) do (
set /A var1=%%a+3
for /f "eol= tokens=1 delims=" %%b in (c:\fr2a.txt) do (
set /A var2=%%b+2
if "!var1!"=="!var2!" echo !var1!>> c:\for1.txt
)
)
for /f "eol= tokens=1 delims=" %%a in (c:\fr3a.txt) do (
set /A var1=%%a+1
for /f "eol= tokens=1 delims=" %%b in (c:\for1.txt) do (
set /A var2=%%b
if "!var1!"=="!var2!" echo !var1!>> c:\for2.txt
)
)
for /f "eol= tokens=1 delims=" %%a in (c:\fr4a.txt) do (
set /A var1=%%a
for /f "eol= tokens=1 delims=" %%b in (c:\for2.txt) do (
set /A var2=%%b
if "!var1!"=="!var2!" echo !var1!>> c:\for3.txt
)
)
Yes, the "d" was a typo.. still scratching my head over that one.
Enabling delayed expansion did the trick, the output is becoming what I want it to be now. Unfortunately, the repetition of the pattern throughout the files has provided me with 11 places in which the pattern repeats, and I'm searching for 1...
Which brings me to my next problem. Right now, I have 10 "FOR" loops (three of them nested), 11 files being created and the file I'm searching through is a slim 45KB instead of the 10,000KB that it could get up to. And, I'm only searching for a pattern which is 4 lines of text. If I need to expand that into 8 or more, that's going to start consuming time. Is there any way to manipulate the flow of data so that it works more efficiently?
As for output, what I'm looking for is a single instance of a known pattern within the file, which comes immediately before the data I'm searching for. In order to find its location, I grabbed the line numbers from each text I was searching for, and output them, then compared them. My comparison of the 4 files (one for each string in the pattern) has yielded 11 locations where the 4-string pattern is found. I need to find a pattern which yields 1 single location. Once I can find that, I'm sure I can figure out the rest on my own. Don't want to make it too easy on myself.