Re: search for words, if found, tell me




"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\/\/
> >


.



Relevant Pages

  • Re: Configuring FreeBSD 6.2 to use sendmail for sending only
    ... I'd prefer to have the script handle the ... Both Sendmail and Postfix ... Chuck), can do this and a lot more. ... freebsd-questions@xxxxxxxxxxx mailing list ...
    (freebsd-questions)
  • Re: Configuring FreeBSD 6.2 to use sendmail for sending only
    ... I'd prefer to have the script handle the ... I want to use cron to run the script, ... script handle the mailing instead of cron. ... Please don't mistake terseness for "condescending". ...
    (freebsd-questions)
  • Re: seeking mailing list from SQL
    ... I know about the script possibility, ... unsubscribes from the mailinglist a minute before a new mail is ... I'd much rather have the mailing ... ::': proud Debian developer, admin, and user ...
    (Debian-User)
  • Re: Configuring FreeBSD 6.2 to use sendmail for sending only
    ... mailing so I can test the script ... manually, independent of cron. ... bourne shell script example that sends an email. ... MailScanner thanks transtec Computers for their support. ...
    (freebsd-questions)
  • Re: search for words, if found, tell me
    ... I have lot of NTbackup logs. ... and if they contain specified words ('error' or 'in use' [bad backup]) send me an email. ... to do the mailing you could use a script from the scriptcenter or a freeware tool like blat.exe ...
    (microsoft.public.windows.server.scripting)