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

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

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 = fi1.ReadLine
  If dic.Exists(str) Then
    dic.Item(str)=dic.Item(str)+1
  ElseIf Not Left(str,1)="#" Then
    dic.Add str, 1
  End If
Wend

For Each key In dic
  If dic.Item(key) > 1 Then
    fi2.WriteLine Mid(key,InStrRev(key," "))*dic.Item(key)
  End If
Next

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

Отправлено: 19:35, 20-05-2011 | #2