Skip to content

Instantly share code, notes, and snippets.

@brovish
Created February 6, 2024 14:26
Show Gist options
  • Select an option

  • Save brovish/72860d69000a6e58d0d27522b5bce968 to your computer and use it in GitHub Desktop.

Select an option

Save brovish/72860d69000a6e58d0d27522b5bce968 to your computer and use it in GitHub Desktop.
search word in files
@echo off
setlocal EnableDelayedExpansion
set "FOLDER_PATH=D:\Software\FAF\Logs\lex"
set "TEMP_FILE=%TEMP%\temp_results.txt"
if exist "%TEMP_FILE%" del "%TEMP_FILE%"
for /R "%FOLDER_PATH%" %%f in (*_2_6_2024.log) do (
set /a count=0
for /f "tokens=3" %%i in ('find /c /i "pid" "%%f"') do (
set /a count=%%i
)
echo !count!, %%f>> "%TEMP_FILE%"
)
sort "%TEMP_FILE%"
del "%TEMP_FILE%"
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment