this is off the cuff, but something like (you may need to play around with the pattern):
Const ForReading = 1
Const ForWriting = 2
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Text Files|*.Txt"
intResult = objDialog.ShowOpen
If intResult = 0 Then
Wscript.Quit
Else
strFileName = objDialog.FileName
wscript.echo strFileName
End If
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading, True)
Set objFilew = objFSO.OpenTextFile("c:\outputfile.txt", ForWriting, True)
[red]Set oRE = New RegExp
oRE.Pattern = ".{225}3.*40.*"[/red]
Do Until objFile.AtEndOfStream
strCurrentLine = objFile.ReadLine
if [red]oRE.Test(strCurrentLine)[/red] Then
intRight = Len(strCurrentLine) - 3
strRight = Right(strCurrentLine, intRight)
strLeft = Left(strCurrentLine, 3)
strInsert = "*******Insert Text*********"
strText = strLeft & strInsert & strRight
strContents = strCurrentLine & strText & vbCrLf
wscript.echo strContents
objFilew.WriteLine strText
Else
objFilew.WriteLine strCurrentLine
End If
Loop
objFile.Close
objFilew.Close
MsgBox "Complete"
[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]