Return previous line with Findstr

batch-file, cmd, findstr, windows

Solution

try this with grep for Windows:

grep -1 "ActualStartDate:" *.txt

output is eg.:

file.txt-cds
file.txt:ActualStartDate: invalid date

Problem

I am running `FINDSTR` command to find specific text in .txt files. I want to print matching lines as well as 1 previous line. ``` findstr "ActualStartDate:" * > a.txt ``` if my file is like this ``` abcd defg cds ActualStartDate: invalid date ``` Result should be like this ``` cds ActualStartDate: invalid date ```

Original source