vbs 试试?- Set fso = CreateObject("Scripting.FileSystemObject")
- text = fso.OpenTextFile("a.txt",1).ReadAll
-
- Set re = New RegExp
- re.Pattern = "(\d{4}-\d{2}-\d{2}_.*(?:[\r\n]*))+"
- re.Global = True
- For Each a in re.Execute(text)
- text = Replace(text,a,Sort(Split(a,vbCrLf)))
- next
-
- Function Sort(ar)
- For i = 0 to UBound(ar)-1
- For j = i + 1 to UBound(ar)
- If ar(i) < ar(j) Then
- tmp = ar(i) : ar(i) = ar(j) : ar(j) = tmp
- End If
- Next
- Next
- Sort = Join(ar,vbCrLf)
- End Function
-
- fso.CreateTextFile("b.txt",True).Write text
- MsgBox "OK"
复制代码
|