Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Googler


Сообщения: 3665
Благодарности: 1563

Профиль | Отправить PM | Цитировать


Код: Выделить весь код
Set dic = CreateObject("Scripting.Dictionary")
Set fso = CreateObject("Scripting.FileSystemObject")

Set fi1 = fso.OpenTextFile("file1.txt", 1)
Set fi2 = fso.OpenTextFile("file2.txt", 2, vbTrue)

While Not fi1.AtEndOfStream
  str = Trim(fi1.ReadLine)
  cnt = Int(Mid(str,InStrRev(str," ")+1))
  str = Mid(str,1,InStr(str," ")-1)
  If dic.Exists(str) Then
    dic.Item(str)=cnt+dic.Item(str)
  ElseIf Not Left(str,1)="#" Then
    dic.Add str, cnt
  End If
Wend

For Each key In dic
  fi2.WriteLine key & vbTab & dic.Item(key)
Next

fi1.Close
fi2.Close
Это сообщение посчитали полезным следующие участники:

Отправлено: 06:00, 21-05-2011 | #4