1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Const INPUT_FILE_1 = "c:\test\poste.csv"
Const INPUT_FILE_2 = "c:\test\tscip.txt"
Const OUTPUT_FILE = "c:\test\result.csv"
Const ForReading = 1
Const ForWriting = 2
Dim dicPostes, dicTSCIP, strKey, fso, ts, strItem
Dim filInput1, filInput2, filResults, strLine, bolFound
Set fso = CreateObject("Scripting.FileSystemObject")
Set filInput1 = _
fso.OpenTextFile(INPUT_FILE_1, ForReading)
Set filInput2 = _
fso.OpenTextFile(INPUT_FILE_2, ForReading)
Set filResults = _
fso.OpenTextFile(OUTPUT_FILE, ForWriting, True)
strLine = filInput1.ReadLine
Set dicPostes = CreateObject("Scripting.Dictionary")
While Not filInput1.AtEndOfStream
strLine = filInput1.ReadLine
dicPostes.Add Split(strLine, ";")(0), Array(Split(strLine, ";")(1), Split(strLine, ";")(2), Split(strLine, ";")(3), Split(strLine, ";")(4))
'numero;nom;prenom;type de poste;nom entité
Wend
filInput1.Close
strLine = filInput2.ReadLine
Set dicTSCIP = CreateObject("Scripting.Dictionary")
While Not filInput2.AtEndOfStream
strLine = filInput2.ReadLine
dicTSCIP.Add Split(strLine, ";")(2), Array(Split(strLine, ";")(6), Split(strLine, ";")(7), Split(strLine, ";")(8), Split(strLine, ";")(13))
Wend
filInput2.Close
filResults.WriteLine "Numéro;Nom;Prenom;Type de poste;Nom entité;MAC;Adresse IP;Numéro domaine;IP-Softphone;Anomalie"
For Each strKey In dicPostes
strItem = dicPostes.Item(strKey)
If Not dicTSCIP.Exists(strKey) Then
filResults.WriteLine strKey & ";" & Join(strItem, ";") & ";;;;;Numero uniquement dans la base Poste"
Else
filResults.WriteLine strKey & ";" & Join(strItem, ";") & ";" & Join(dicTSCIP.Item(strKey), ";")
End If
Next
For Each strKey In dicTSCIP
strItem = dicTSCIP.Item(strKey)
If Not dicPostes.Exists(strKey) Then
filResults.WriteLine strKey & ";;;;;" & Join(strItem, ";") & ";Numero uniquement dans la base TSC-IP"
End If
Next
filResults.WriteLine vbCrLf
filResults.WriteLine "Lignes compter dans Postes " & _
"(" & dicPostes.Count & ") and TSC-IP " & _
"(" & dicTSCIP.Count & ")."
filResults.Close |
Partager