Hi, I have this code that works fine for replacing in TXT file. I need to change the code so only to perform the replace in groups of text.
Example: Replace only in text after the line starts with “Report-Output” and before the line that stars with “Report End”
Report-Output
?????
??????????????
???????
??
Report End
Help with the code would be appreciated or a link to sample code that i can work with.
Thanks
Code:
Dim Fs As FileStream = New FileStream("C:\report.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
Dim sw As New StreamWriter(Fs)
Dim sr As New StreamReader(Fs)
Dim str As String
str = sr.ReadToEnd
str = str.Replace("Item-ID", "Stock-ID")
Fs.Position = 0
Fs.SetLength(str.Length)
sw.Write(str)
sw.Flush()
sw.Close()
Fs.Close()
Example: Replace only in text after the line starts with “Report-Output” and before the line that stars with “Report End”
Report-Output
?????
??????????????
???????
??
Report End
Help with the code would be appreciated or a link to sample code that i can work with.
Thanks