Hi All,
I would like to do a search and replace on a flat file. i would like to find a wildcard of a string and completely update the line with a new string.
For example my orginal file is:
Jim and Dog
George and Cat
Karen and Rat
Sam and Puppy
I would like the output of the new file.
James
George and Cat
Karen and Rat
Sam and Puppy
Here is my code.
Dim path As String = "C:\river1.txt"
Dim strText As String = File.ReadAllText(path)
Dim objFile As System.IO.StreamWriter
strText = Replace(strText, "Jim ", "James ")
objFile = My.Computer.FileSystem.OpenTextFileWriter("C:\river1.txt", False)
objFile.Write(strText)
objFile.Close()
Thank you,
-Kagome