Requirement:
To Search the given files under current directory for given strings. If anything found to be written to a file.
Sample Screen:
Main Script: CHK_Error.bat
@echo off set fname= IF %1. NEQ . (set fname="C:\Accounts\CalWIN\Build\SQLServer\DOS_Batch\%1*.lst") ELSE ( GOTO _Usage ) for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j for /F "tokens=1-2 delims=: " %%l in ('time /t') do set hhmm=%%l%%m set filename=Error_%yyyymmdd%%hhmm%.txt echo "Error Log file name is : " %filename% echo "files to be searched : " %fname% findstr /i /n /g:search.txt %fname% > %filename% if %errorlevel% == 0 (GOTO :_Error_Found ) else ( :_Error_Found :_Usage :END |
Search.txt
msg |
Input Files: file1.lst
dgadagdagad st messgae adgadg agadgadgadadadsflmsvbkobsagad dgadgadg dgad gadagad gagad msg 128, 9341353513 |
Input Files: file2.lst
test messgae dgadgadg dgad gadagad gagad msg 128, 9341353513 |
No comments:
Post a Comment