I have this short config.txt with 2 lines
Preamp: 11dB
Include: example.txt
Is there a way for batch to find number before dB and replace it with either 1 higher or 1 lower?
@ECHO OFF
REM read two lines:
<config.txt (
set /p "line1="
set /p "line2="
)
REM isolate the number:
set "line1=%line1:* =%"
set "line1=%line1:dB=%"
REM add one:
set /a line1+=1
REM write new file:
>config.txt (
echo Preamp: %line1%dB
echo %line2%
)
11dB, and set thedas the end of line character.for /f "usebackq eol=d tokens=2" %%I in ("%configfile%") do if not defined dB set /a dB=%%I + 1or- 1