Search code examples
batch-filefinddos

Dos batch file to find a specific value in first 6 columns


I have to create a dos batch file that will look at a text file and check if the word ERRORS is in columns

123456
ERRORS

The word appears in other parts of the text file but those are not an issue.

This is what I have so far

Find "ERRORS" c:\temp\*.txt >> c:\temp\check_errors.txt

Thank you


Solution

  •  Findstr /r ".......ERRORS" c:\temp\*.txt >> c:\temp\check_errors.txt
    

    should do the trick - seven dots (each one represents one character-position) since you have six digits and a space before the string "ERRORS".