本帖最后由 pcl_test 于 2015-7-12 22:53 编辑
发个vbs- Dim fso,File1,File2,str,Dict
- Set Dict = CreateObject("Scripting.Dictionary")
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set File1 = fso.OpenTextFile(".\测试.txt", 1)
- Set File2 = fso.CreateTextFile(".\结果.txt", 2 ,False)
- Do While File1.AtEndOfStream <> True
- str = File1.ReadLine
- If Dict.Exists(str) <> True Then
- File2.WriteLine str
- Dict.Add str, 1
- Else
- File2.WriteLine str&" "&Dict.Item(str)
- Dict.Item(str) = Dict.Item(str)+1
- End If
- loop
- File1.Close
- File2.Close
- Dict.RemoveAll
- Set Dict = Nothing
- MsgBox "完成!"
复制代码
|