so in short my script is currently outputting csv with the log name, timestamp (10:38:52) and message (Verification: SUCCESS and SendResponse: Response message).
Now I need this script to be able to calculate and output the time difference between the timestamp on the first message and the timestamp in the second message and provide the average value 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 only call the following lines
[20110314T103852][EMVLib][5056][I000000]: Verification: SUCCESS [20110314T103902][CSV][3232][D000000]: SendResponse: Response message
These search strings are defined by searchstrings.txt
Thanks for any help with this!
source share