本帖最后由 yhcfsr 于 2018-4-18 21:53 编辑
回复 6# tigerpower
楼上说得有理。逐行处理文本的方式,对于长文本的确不合适。
因此我尝试POWERSHELL,做了个71W行的文本(26M),用powershell处理了也花68S,而用记事本打开,替换,保存也就10多秒的事。
15W行,8.8秒处理完成。
以下是测试代码:- cls;
- $file=$null;
- $time=get-date
- $file=Get-Content "d:\test\out.txt";
- $file=($file -replace ':','');
- out-file "d:\test\out.txt" -InputObject $file;
- ((get-date)-$time).TotalSeconds
复制代码
|