sed不会,vbs练习中- Set fso = CreateObject("Scripting.FileSystemObject")
- Set dic = CreateObject("Scripting.Dictionary")
- Set file = fso.OpenTextFile("a.txt")
-
- Do Until file.AtEndOfStream
- strLine = file.ReadLine
- strKey = Left(strLine,11)
- If Not dic.Exists(strKey) Then
- dic.Add strKey,strLine
- Else
- dic.Item(strKey) = dic.Item(strKey) & vbLf & strLine
- End If
- Loop
-
- For Each a in dic.Keys
- If UBound(Split(dic.Item(a),vbLf)) = 0 Then
- str = str & dic.Item(a) & vbCrLf
- End If
- Next
-
- fso.CreateTextFile("b.txt",True).Write str
- MsgBox "OK"
复制代码
|