Hi Experts! With the help of a few brilliant minds, I have script that will query a log file on several servers and copy the data in that log file based on the date field to a central log file.
The next step for this script is to copy the data that starts with
03/06/2014 19:04:08 --- SCHEDULEREC STATUS BEGIN
and ends with
03/06/2014 19:04:08 --- SCHEDULEREC STATUS END
In this example, I would use 03/06/2014 as the date the script needs to look for in the log file, find --- SCHEDULEREC STATUS BEGIN and copy that and all text below it until it reaches this line --- SCHEDULEREC STATUS END
I am attaching the script that is already built to find the date in the log file so that we can build off of it. Thank you experts!!
if "%~1"=="" (
set /p FindDate=Enter date to search:
) else (
if "%FindDate%"=="" goto :eof
for /f "tokens=1 delims=" %%a in ('type "%~f0" ^| find /i /n "[DATA]"') do set DataStart=%%a
for /f "skip=%DataStart% delims=" %%a in ('type "%~f0"') do (
echo Processing '%%a' ...
type "%%a" | findstr.exe "^%FindDate%" >>"%CentralLog%"
if errorlevel 1 (
echo Date not found in '%%a'.