The file size is problematic for loading entire file contents as one large string into memory of JavaScript core engine and run the finds directly on the large string. The most efficient method is not possible for that reason. It can take several minutes with the window updates to run all the finds on such files.
It could be made perhaps faster using
Find in Files and load the number of total found strings from the output window if the log file is always a named file on a network drive or a local drive. But then the script depends on the configuration of
Find output format for
File summary which is in general not good.
I would need the exact version of UltraEdit as displayed in
About window where the version can be also selected and copied with
Ctrl+C to the clipboard. Then I could restore exactly the same version from my personal archives and try the script on a file with 500,000 lines.
But honestly I would do that job with a simple batch file or a PowerShell script instead of using an UltraEdit script because UltraEdit is a graphical user interface application and the task can be done with an UltraEdit very difficult without document window refreshes making the script execution time very long in comparison to a program which just searches for a string and count the found occurrences and do not that without any graphical window updates.
Here is a batch file solution on which just the log file name on third line must be adapted to get a
.txt file with name of the batch file in the directory of the batch file with the results.
Code: Select all
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "LogFile=C:\Temp\Test.log"
if exist "%LogFile%" goto ProcessFile
echo ERROR: File "%LogFile%" does not exist.
echo(
pause
exit /B
:ProcessFile
set "TempFile=%TEMP%\%~n0.tmp"
set "ResultsFile=%~dpn0.txt"
copy "%LogFile%" "%TempFile%" >nul
setlocal EnableDelayedExpansion
(for /L %%I in (1,1,100) do set "Number=00%%I" & for /F "tokens=3 delims=:" %%J in ('%SystemRoot%\System32\find.exe /C "[Node !Number:~-3!]" "!TempFile!"') do if not "%%J" == " 1" (echo Node !Number:~-3! found%%J times) else echo Node !Number:~-3! found%%J time)>"!ResultsFile!"
endlocal
del "%TempFile%"
endlocal
Please note that the Windows command
FIND counts just the lines containing the searched string and not the number of found strings. The result is wrong if a line contains a searched string more than once.