Extract part of a text file using Windows batch

前端 未结 3 945
梦毁少年i
梦毁少年i 2020-12-22 01:59

I have a text file and I\'m interested to have only a part of it, all that is included between wordA and wordB

Is that possible using a cmd batch file?

3条回答
  •  無奈伤痛
    2020-12-22 02:21

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

    Put repl.bat in the same folder as the batch file.

    @echo off
    type infile |repl ".*wordA(.*)wordB.*" "$1" >outfile
    

提交回复
热议问题