如何删除文件名中的FINDSTR输出文件 [英] How to remove filename in findstr output file
问题描述
我使用FINDSTR搜索和输出我的搜索到另一个txt文件,但需要省略文件名,谁能帮助请?在此先感谢!
I use findstr to search and output my search to another txt file but need to omit the filename, can anyone help pls? Thanks in advance!
我目前的批处理文件: -
FINDSTRTEST的* .dat> output.txt的
My current batch file :- findstr "TEST" *.dat > output.txt
和output.txt中的所有文件名文件* .dat文件(我需要删除)的结果: -
and the result of output.txt with all the filename Doc*.dat(which I need to remove):-
文件(1).dat文件:2014年4月15日;测试技术有限公司
文件(10).dat文件:2014年4月29日;测试技术有限公司
文件(11).dat文件:二○一四年四月三十〇日; TEST TECHNOLOGY LTD结果
文件(12).dat文件:2014年5月2日;测试技术有限公司
文件(13).dat文件:2014年5月5日;测试技术有限公司
文件(14).dat文件:2014年5月6日;测试科技有限公司
Doc (1).dat:2014-04-15;TEST TECHNOLOGY LTD
Doc (10).dat:2014-04-29;TEST TECHNOLOGY LTD
Doc (11).dat:2014-04-30;TEST TECHNOLOGY LTD
Doc (12).dat:2014-05-02;TEST TECHNOLOGY LTD
Doc (13).dat:2014-05-05;TEST TECHNOLOGY LTD
Doc (14).dat:2014-05-06;TEST TECHNOLOGY LTD
最好的问候,
是W
Best Regards, W
推荐答案
FINDSTR
写入文件名,当您使用通配符。
findstr
writes the filename, when you use wildcards.
替代:
使用另一个命令,不写名在同一行内容:
use another command, that doesn't write the filename in the same line as the content:
find "TEST" *.dat |find "TEST" >output.txt
或
使用 FINDSTR
不带通配符(使用为
循环在每次提供一个文件名)
use findstr
without wildcards (use a for
loop to supply one filename at a time)
for %%i in (*.dat) do findstr "TEST" %%i >>output.txt
这篇关于如何删除文件名中的FINDSTR输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!