360degreehosting
IS-IT--Management
Hello,
I have some text files i need to deduplicate.
I have started with the following code but I'm getting an error and don't know where to go from here.
File 1 text file contents:
steve@123.com
steve@234.com
steve@123.com
I'm wanting to check if the string already exists in the File 2 text file yet and only if it is not should it write the string from File 1 text file.
If the script runs correctly File 2 should contain:
steve@123.com
steve@234.com
If someone has a better suggestion of how to do this I am interested in learning a better way.
Thank you for your help....
I have some text files i need to deduplicate.
I have started with the following code but I'm getting an error and don't know where to go from here.
File 1 text file contents:
steve@123.com
steve@234.com
steve@123.com
I'm wanting to check if the string already exists in the File 2 text file yet and only if it is not should it write the string from File 1 text file.
If the script runs correctly File 2 should contain:
steve@123.com
steve@234.com
If someone has a better suggestion of how to do this I am interested in learning a better way.
Thank you for your help....
Code:
varFile1 = "C:\file1.txt" 'see above for File 1 contents
varFile2 = "C:\file2.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set fle1 = objFSO.OpenTextFile(varFile1,1)
Set fle2 = objFSO.OpenTextFile(varFile2,2)
Do While Not fle1.AtEndofStream 'Change this line, Change this one too
strLine = fle1.ReadLine
If InStr(StrLine, "@") > 0 Then
Response.Write StrLine & "<br>"
If InStr(fle2.Readall, StrLine) = 0 then
fle2.WriteLine StrLine
End If
End If
Loop
fle1.close
Set fle1 = nothing
fle2.close
Set fle2 = nothing
Set objFSO = nothing