I am trying to write a batch executable which finds and echo's a specific line: "Rating.RESP:" from a .txt-file eg. 'Rating.RESP: 50'. Numbers go from 0-100 and I want the console to prompt all variables and I do not want to copy it to another txt file.
Thus far I am trying to work with findstr:
for /F %%i in (data.txt) do (
echo %%i
findstr /m /c:"Rating.RSP: [0-100]"%%i
)
Any tips? If this works I would be able to further extent the batch executable.
Based on @Gerhard 's help I made the following code:
set /p file=Drag data file in here.
echo.
for /F "delims=" %%i in ('type %file% ^| findstr /m "Rating.RESP: "') do echo %%i
The result is a list of 'Rating.RESP: ##'
Next up I'm trying to read the %%i and echo a warning when it exceeds 75 or below 25. Any idea's? I was thinking something with extracting the last two characters of the substring and check if it is within (or outside) the threshold. Don't need the help just yet, I'm trying to figure it out myself. Thanks again for the help with echoing Rating.RESP.
Sample input file:
*** Header End ***
Level: 2
*** LogFrame Start ***
list: 1
Procedure: proc
leftanchor: Alert
rightanchor: Suf
XTime: 09:55:25
list.Cycle: 1
list.Sample: 1
Running: list
Scale1.RT: 2054
Scale1.RESP: 1
Response: t056
Rating.RESP: 56
*** LogFrame End ***
Level: 2
*** LogFrame Start ***
list: 2
Procedure: proc
leftanchor: Kalm
rightanchor: Opgewonden
XTime: 09:55:28
list.Cycle: 1
list.Sample: 2
Running: list
Scale1.RT: 861
Scale1.RESP: 1
Response: t050
Rating.RESP: 50