欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

文件内容操作batch

程序员文章站 2022-05-08 19:21:18
...

I've learnt it from csdn qybao(阿宝), thanks for him^^

 

for example, we need replace or delete some string in the text file, in common way, i'd like to use java to fulfil it, but here use batch...

 

 

findstr /V ABCDEFG search.txt > xx.txt
del search.txt
ren xx.txt search.txt

 

with this batch, it deletes the line which contains the string "ABCDEFG" and generates the new file xx.txt

 

here's the explanation of the dos command findstr and its parameter /V

 

http://www.computerhope.com/findstr.htm

 

相关标签: DOS