Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file which searches for the keywords  (Read 2458 times)

0 Members and 1 Guest are viewing this topic.

rajith.pn

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    Batch file which searches for the keywords
    « on: January 21, 2011, 09:15:45 AM »
    Hi

    @echo off

    for /f "tokens=* delims= " %%a in ('dir /b/s D:\sba81\siebsrvr\log\*.log') do (
    find "Error " < %%a >> Error.txt
    )

    I need to enhance this bach file such that "It should ignore the keywords i mention in the loop and output only the lines which are not containing the mentioned keywords in the loop"

    Explanation :

    I need to specify some 30 keywords in the loop to ignore if the batch file finds those words while searching files. Because those are ignorable errors. So it should ignore those words containing lines and it should copy all the lines which doesn't contain those keywords to the output file.

    Please read clearly above requirement once again and give me enhanced solution for the batch file i have given on top.

    thanks a lot in advance

     

    Salmon Trout

    • Guest
    Re: Batch file which searches for the keywords
    « Reply #1 on: January 21, 2011, 04:39:17 PM »
    if exist error.txt del error.txt
    for /f "tokens=* delims= " %%a in ('dir /b/s D:\sba81\siebsrvr\log\*.log') do findstr /v "keyword1 keyword2 etc" "%%a">>error.txt

    « Last Edit: January 21, 2011, 04:54:44 PM by Salmon Trout »