|It's a long time since I last wrote a .bat file. I need to parser an IIS log file and and output another file which contains just external IP addresses. I have written two batch files to do this. The 1st contains the lines:|
FOR /F "TOKENS=* SKIP=3 DELIMS=\n" %%a IN (^%N%.log) DO (
ECHO %%a > log_temp.tmp
CALL log_filter.bat log_temp.tmp
And the 2nd called log_filter.bat contains
TYPE d:\log_temp.tmp|FIND "192.168"
IF ERRORLEVEL 1 GOTO NOT_FOUND
IF ERRORLEVEL 0 GOTO XIT
TYPE d:\log_temp.tmp >> d:\log_cleaned.txt
It works - but hits the server resources, CPU 100% whilst processing a 35MB file and takes an hour to complete.
Is there a way to read each line into memory to improve performance, rather than output for each line being written to a temp file?