Code: Select all
@echo off
setlocal enabledelayedexpansion
REM Line number of the delimiter line:
for /F "delims=:" %%a in ('findstr /N "^xxyyzz" "Input.bin"') do set "lines=%%a"
echo %lines%
REM Extract the part of the Input.bin following the delimiter line:
< "Input.bin" (
REM Pass thru the first lines:
for /L %%i in (1,1,%lines%) do set /P "="
REM Copy the rest to output bin:
findstr "^"
) > Output.bin
"The line too long error only happens when FINDSTR reads the input via redirection or a pipe. That error goes away if you pass the name (path) of the file directly to FINDSTR."
My understanding of batch-command syntax is too poor to find out how this could be done in my above script. Can someone here help?
Cheers.