Certainly SteveGTR has the process required and requested.
After a bit of tinkering, I found a way to introduce the form-feeds as well & combined the code I dreamt up with SteveGTR's :
(OK - so it gives a form-feed as the first character. That could be cured, too..)
@echo off
if [%1]==[] goto USAGE_ERR
if not exist %1 goto USAGE_ERR
if exist OUTPUT.DAT del OUTPUT.DAT > NUL
set zff=
for /f "tokens=*" %%i in ('type %1^|find "Cash Transaction Report"') do (set fileline=%%i&call :processf)
for /f "delims=" %%f in (%1) do (
set fileline=%%f
call :PROCESS
)
echo Done! OUTPUT.DAT contains new report.
set zff=
set fileline=
goto EXIT
:PROCESS
echo "%fileline%" | findstr /c:"Cash Transaction Report" > NUL
if ERRORLEVEL 1 goto NOT_FOUND
REM ** Here is where you would customize the header
echo %zff%New Header1 >> OUTPUT.DAT
echo New Header2 >> OUTPUT.DAT
echo New Header3 >> OUTPUT.DAT
goto EXIT
:processf
if defined zff goto :eof
set zff=%fileline:~0,1%
for %%a in (a b c d e f g i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0) do call :notalpha %%a
goto :eof
:notalpha
if /i "%zff%"=="%1" echo zff zapped on %1
if /i "%zff%"=="%1" set zff=
goto :eof
:NOT_FOUND
echo %fileline% >> OUTPUT.DAT
goto EXIT
:USAGE_ERR
echo Usage: %0 filename
:EXIT
Main Topics
Browse All Topics





by: SteveGTRPosted on 2003-06-09 at 14:36:19ID: 8685780
Give this a try:
@echo off
if [%1]==[] goto USAGE_ERR
if not exist %1 goto USAGE_ERR
if exist OUTPUT.DAT del OUTPUT.DAT > NUL
for /f "delims=" %%f in (%1) do (
set fileline=%%f
call :PROCESS
)
echo Done! OUTPUT.DAT contains new report.
set fileline=
goto EXIT
:PROCESS
echo "%fileline%" | findstr /c:"Cash Transaction Report" > NUL
if ERRORLEVEL 1 goto NOT_FOUND
REM ** Here is where you would custimize the header
echo New Header1 >> OUTPUT.DAT
echo New Header2 >> OUTPUT.DAT
echo New Header3 >> OUTPUT.DAT
goto EXIT
:NOT_FOUND
echo %fileline% >> OUTPUT.DAT
goto EXIT
:USAGE_ERR
echo Usage: %0 filename
:EXIT
Good Luck,
Steve