vbs试试?应该比纯批快- Set fso = CreateObject("Scripting.FileSystemObject")
- Set dic = CreateObject("Scripting.Dictionary")
- Set file = fso.OpenTextFile("aa.txt")
-
- Do until file.AtEndOfStream
- strLine = RegEx(file.ReadLine)
- If strLine <> "" Then
- str1 = Left(strLine,5) : str2 = Right(strLine,5)
- IF Not dic.Exists(str1) Then
- dic.Add str1,str2
- Else
- dic.Item(str1) = dic.Item(str1) & vbLf & str2
- End If
- End If
- Loop
-
- a = dic.Keys
- For i = 0 to UBound(a)
- b = Split(dic.Item(a(i)),vbLf)
- Max = "00000"
- For j = 0 to UBound(b)
- If b(j) > Max Then Max = b(j)
- Next
- str = str & a(i) & Max & vbCrLf
- Next
- fso.CreateTextFile("bb.txt",True).Write Str
-
- MsgBox "OK"
-
- Function RegEx(strLine)
- Set re = New RegExp
- re.Pattern = "\s+"
- re.Global = True
- RegEx = re.Replace(StrLine,"")
- End Function
复制代码
|