so in short my script currently outputs a csv with the log name, time stamp (10:38:52) and the message (Verification: SUCCESS and SendResponse: Response message).
I now need for this script to be able to calculate and output the time difference between the time stamp on the first message and the timestamp on the second message and provide an average at the bottom of the csv.
@echo off
setlocal EnableDelayedExpansion
echo."Location","Date Time","Result","diff" > output2.csv
(
for %%a in (z:\logdir\*.log) do (
for /f "tokens=1,2,3,4,5,6,7,8,9,10 delims=[+]" %%B in ('findstr /g:searchstrings.txt ^< %%a') do (
set var=%%B
set var1=!var:~-6!
echo."%%a","!var1!","%%B","%%F","timetaken"
)
)
) >> output2.csv
the log file contains many entries but this script should and does pull out just the following lines
[20110314T103852][EMVLib][5056][I000000]: Verification: SUCCESS
[20110314T103902][CSV][3232][D000000]: SendResponse: Response message
These search strings are defined by file searchstrings.txt
Thanks for any help on this!