filename=
"route.txt"
filename2=
"route2.txt"
Set
WshShell =CreateObject(
"WScript.Shell"
)
currentpath= WshShell.CurrentDirectory
Set
fso = createobject(
"Scripting.FilesystemObject"
)
Set
fileObj = fso.OpenTextFile(currentpath&"\"&filename,1)
Set
fileObj2 = fso.OpenTextFile(currentpath&"\"&filename2,2,true)
Do
while
Not
fileObj.AtEndOfStream
content = fileObj.ReadLine
strResult=
""
If
RegExpTest(
"^route.*"
,content)
Then
strArray=split(content,
" "
,-1)
strLast=strArray(UBound(strArray))
strLastArray=split(strLast,
"."
,-1)
strLen=UBound(strLastArray)
For
i=Lbound(strLastArray) to UBound(strLastArray)
str2=255-strLastArray(i)
strResult=strResult&str2&
"."
Next
strResult=left(strResult,len(strResult)-1)
For
i=Lbound(strArray) to UBound(strArray)-1
strFinalResult = strFinalResult &
" "
& strArray(i)
Next
strFinalResult = strFinalResult &
" "
&strResult &
" "
&
"106.34.168.2 "
& vbcrlf
End
If
Loop
fileObj2.Write strFinalResult
fileObj2.Close
fileObj.Close
Function
RegExpTest(patternstr,str)
Dim
regEx, retVal
Set
regEx =
New
RegExp
regEx.Pattern = patternstr
regEx.IgnoreCase =
False
retVal = regEx.Test(str)
If
retVal
Then
RegExpTest=
True
Else
RegExpTest=
False
End
If
End
Function
msgbox
"finish"