findstr没有按预期保存新文件

时间:2015-03-19 09:15:11

标签: windows command-line findstr

我使用此命令在使用findstr

搜索查询后创建新文件
find /c "Total record count" Movements_*.csv.old   && ( findstr /v /c:"Total record count" Movements_*.csv.old >> result.csv)

这是在result.csv中保存预期的结果,但在数据之前和之后添加了Movements_20150317,如下所示:

"Movements_20150317.csv.old:AGREEMENT,CURRENCY,MARGIN TYPE,AGREEMENT BRANCH NAME,AGREEMENT BRANCH CIS CODE,NOTIONAL LABEL,IDMovements_20150317.csv.old:"

请建议,如何删除?

谢谢!

1 个答案:

答案 0 :(得分:1)

试试这个:

find /c "Total record count" Movements_*.csv.old   && ( for %a in (Movements_*.csv.old) do @findstr /v /c:"Total record count" "%~a" )>result.csv