Dim objSourceFile, objKeywordFile, objNewFile, objFSO
Dim currentline, currentvariable, bIncluded
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSourceFile = objFSO.OpenTextFile("D:\sourcefile.txt")
Set objKeywordFile = objFSO.OpenTextFile("D:\keywordfile.txt")
Set objNewFile = objFSO.CreateTextFile("D:\result.txt")
bIncluded = False
Do While Not objSourceFile.AtEndOfStream
currentline = objSourceFile.ReadLine
Call CheckIfIncluded
Loop
Function CheckIfIncluded
Do While Not objKeywordFile.AtEndOfStream
currentvariable = objKeywordFile.ReadLine
If InStr(currentline,currentvariable) Then
bIncluded = False
Exit Do
Else
bIncluded = True
End If
Loop
If bIncluded = True Then
objNewFile.WriteLine currentline
End If
Set objKeywordFile = Nothing
Set objKeywordFile = objFSO.OpenTextFile("D:\variablefile.txt")
End Function
4/16/2008
vbscript to check each line in a file if there are included keywords defined in another file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment