batch script to print previous and next lines of search string in a text file

后端 未结 3 1724
孤城傲影
孤城傲影 2020-12-30 17:44

I have a batch script which will print the entire line of search string into a text file.

for %%i in (log.txt) do (
FINDSTR /G:pattern.txt %%i >> outpu         


        
3条回答
  •  既然无缘
    2020-12-30 18:19

    This uses a helper batch file called findrepl.bat from - http://www.dostips.com/forum/viewtopic.php?f=3&t=4697

    @echo off
    set "var=searchterm"
    type "file.txt"|findrepl "%var%" /o:-1:+1 |find /v "%var%"
    

提交回复
热议问题