Re: search for words, if found, tell me
- From: "Al Dunbar [MS-MVP]" <alan-no-drub-spam@xxxxxxxxxxx>
- Date: Sat, 12 Nov 2005 11:16:36 -0700
"andrea" <andrea@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:29FB28BC-E471-40C7-A0CE-CDD85AC23A3E@xxxxxxxxxxxxxxxx
> \\/\\o\\/\\/ thanks for reply,
> mailing in vbs is not a problem for me. The question is
> a function that find and tell me only specified words.
"\\/\\o\\/\\/" gave you a batch command to do this, namely:
Type LogName.log | findstr "Text To Search"
but that needs to be followed with something to detect whether or not the
string was found. Also, you seem to be interested in log files that contain
either "error" or "in use", which he did not mention.
You could try something like this:
findstr /i /c:"error" /c:"in use" LogName.txt
if errorlevel 1 (
echo/no errors in log file
) else (
echo/errors found in logfile
rem send message
)
Of course, if the log file lists filenames, there might be a file whose name
contains the string "error", so you can expect some false positives.
/Al
> list of function/syntax i need:
> - open text file
> - read line per line the specified file
> - recognize the 'bad' words (from an array of words)
> - aliment a variable with value
>
> i know that my bad english is an obstacle,
> thank you all
>
> Andrea
>
> "/\\/\\o\\/\\/" wrote:
>
> > andrea wrote:
> > > hello!
> > > I have lot of NTbackup logs. want to 'read' these files, and if
> > > they contain specified words ('error' or 'in use' [bad backup])
> > > send me an email.
> > >
> > > in few words: search for a word, if found, tell me
> > >
> > > thanks in advance for all help, and sorry for bad english
> > >
> > > Andrea
> > >
> > >
> > You can make a script that after the backup, checks the logs by using
> >
> > Type LogName.log | findstr "Text To Search"
> >
> > (try findstr /? for more options)
> >
> > to do the mailing you could use a script from the scriptcenter or a
> > freeware tool like blat.exe
> >
> > gr /\/\o\/\/
> >
.
- Follow-Ups:
- Re: search for words, if found, tell me
- From: /\\/\\o\\/\\/
- Re: search for words, if found, tell me
- References:
- Re: search for words, if found, tell me
- From: /\\/\\o\\/\\/
- Re: search for words, if found, tell me
- Prev by Date: Re: trouble with the function for wmidatestriptodate(dtmeventdate)
- Next by Date: Re: trouble with the function for wmidatestriptodate(dtmeventdate)
- Previous by thread: Re: search for words, if found, tell me
- Next by thread: Re: search for words, if found, tell me
- Index(es):
Relevant Pages
|