I have a log file that i need to go through and find certain strings that do not match and write them out to the log. The code works until the problem arises where it duplicates the last value which is not needed. The code is here:
echo off
set LogFile=log.out
set LogFileSuccess=logFileSuccess.log
set FileName=testali.log
set lastline=
set currentline=
FOR /F "delims= " %%i IN (%FileName%) DO (SET currentline=%%i & CALL :process)
:process
echo %currentline% | findstr /i "AD\System_ES_COG_RMT_D ??? =====" || echo Name Not Identified: %currentline% >> %LogFile%
and the log file is here:
Name Not Identified: 1796 Th:Pseudo Idle - - - -
Name Not Identified: 8572 Th:DynamicConfig Idle - - - -
Name Not Identified: 8008 AD\Kaif,
Name Not Identified: 9332 AD\Mayekar,
Name Not Identified: 5544 AD\Velusamy,
Name Not Identified: 8952 AD\Velusamy,
Name Not Identified: 6460 AD\Velusamy,
Name Not Identified: 1796 Th:Pseudo Idle - - - -
Name Not Identified: 8572 Th:DynamicConfig Idle - - - -
Name Not Identified: 8008 AD\Kaif,
Name Not Identified: 9332 AD\Mayekar,
Name Not Identified: 5544 AD\Velusamy,
Name Not Identified: 8952 AD\Velusamy,
Name Not Identified: 6460 AD\Velusamy,
Name Not Identified: 1796 Th:Pseudo Idle - - - -
Name Not Identified: 8572 Th:DynamicConfig Idle - - - -
Name Not Identified: 8008 AD\Kaif,
Name Not Identified: 9332 AD\Mayekar,
Name Not Identified: 5544 AD\Velusamy,
Name Not Identified: 8952 AD\Velusamy,
Name Not Identified: 6460 AD\Velusamy,
Name Not Identified: 6460 AD\Velusamy,
The last Value is duplicated. Any help would be appreciated thanks.