给你一个三M的代码借鉴效率还可以#include <File.au3>
$aFile = FileOpenDialog("快速删除重复行",@ScriptDir&"","文本文件 (*.txt)", 1 + 4)
If @error Then
MsgBox(0,0,"文件未选择",3)
Exit
EndIf
$begin = TimerInit()
Local $str='',$file_array
_FileReadToArray($aFile,$file_array)
;_ArrayDisplay($file_array)
For $i = 1 To UBound($file_array)-1
$temp=$file_array[$i]
If Not IsDeclared($temp) Then
Assign($temp, $i)
$str&=$temp&@CRLF
EndIf
Next
$dif = TimerDiff($begin)
$out_file=StringTrimRight($aFile,4)&'_已完成.txt'
if FileExists($out_file) then FileDelete($out_file)
FileWrite($out_file,$str)
ShellExecute($out_file)
WinWaitActive("[CLASS:Notepad]")
WinSetTitle("[CLASS:Notepad]", "", '处理'&UBound($file_array)&'行'&' 用时'&int($dif)&'毫秒')
Exit
|