|I have a file in the following format|
For every line that starts with Machine, I want to check the next line in the file and if the next line contains a Machine as well, then i want to copy the original line and copy it to a file.
Line 1 contains MachineA so i check Line 2. In this case Line 2 contains App1 so i would do nothing.
Line 4 contains MachineB so i check Line 5. In this case Line 5 contains MachineC so I would write the value of Line 4 (ie. MachineB) to an external text file.
I've tried playing around with for loops but haven't gotten too far
For /f "tokens=1 delims=" %%a in ('find /n "Machine" ^< example.txt') do (
for /f "tokens=1 delims= %%a in ('find /n /v "" ^< example.txt') do (
This is where i get lost.
Can anyone help?