here is the example content of my file:

line1
line2
line3
line 4
line5
line6


i need only to replace "line 4" into "line4" and here the code to view this line by line:

Set myObj = CreateObject("Scripting.FileSystemObject")

Filestr = "c:\config2.ini"
Set myFile = myObj.OpenTextFile(Filestr)

Do Until myFile.AtEndOfstream
strLine = myFile.ReadLine
If InStr(strLine, "line 4") > 0 Then
strLine = Replace(strLine, "line 4", "line4")
End If
Loop


my problem is, Can this be possible to write the replacement on the readline? help pls.
sorry for my english and explanation...

No, and you are not saving the contents of each line into a variable so you can then later write out the corrected file. Presently you are doing nothing but reading the file and not even closing it, but beyond that, you logic is sound so far...


Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.