hi
I have 100's of .log files in a folder E:\logs
my request is for a batch file that reads a keywords.txt file
the keywords.txt file contain 2 column
1 keyword to search for and 2 corresponding folder to be created.
ie..
MBD MOTHERBOARD
RAM MEMORY
HDD HARDDRIVE
AUDIO SOUNDCARD
........and so on
the batch file should search .log files for keywords and then create corresponding folder mentioned against each keyword
and copy the .log files to them
source directory E:\logs
destination directory g:\sorted
please help me..
thanx in advance..
joe
parsing log files
Moderator: DosItHelp
Re: parsing log files
Code: Select all
@echo off &setlocal
set "listfile=keywords.txt"
set "source=E:\logs"
set "destination=g:\sorted"
for /f "tokens=1,2" %%i in ('type "%listfile%"') do (
for /f "tokens=1,2 delims=:" %%k in ('findstr "\<%%i\>" "%source%\*.log"') do (
2>nul md "%destination%\%%j"
copy "%%k:%%l" "%destination%\%%j\"
)
)
Steffen
Re: parsing log files
this code worked perfectly
thank you steffen for taking so much of you valuable time
thank you steffen for taking so much of you valuable time