On Apr 23, 9:15 am, CoRrRan <CoRrRan~NOSPAM~@~NOSPAM~gmail.comwrote:
Something like this?
**********************************
Required: "Imports System.IO.FileStream"
Dim streamR As StreamReader = New StreamReader("C:\Temp\Input.txt")
Dim streamW As StreamWriter = New StreamWriter("C:\Temp\Output.txt")
While Not streamR.EndOfStream
strInput = streamR.ReadLine
If InStr(strInput, "Begin of Recipe", CompareMethod.Text) 0 Then
strInput = streamR.ReadLine
If Not InStr(strInput, "Endof Recipe", CompareMethod.Text) 0 Then
streamW.WriteLine(strInput)
EndIf
streamW.Flush()
streamW.Close()
EndIfEndWhile
streamR.Close()
**********************************
HTH, CoRrRan
Quentin wrote:
Any code on how to startwriteto a newfilewould be appreciated. In
the example below: How would I start thewriteto afileon theword
"Recipe" and thenwriteevery line beneath it until "Endof Recipe"
dfgsdgfsdfgsdgf
dgfsdfgdfgsdfsdfgsdfg
"Recipe"
edsadfasdfasdfasdfasdf
sadfasdf5twtgfvdfgdfgdsfg
rgg5345454ygdfgdgfdsgdsf
dfgsdgsdfgsdfg
"Endof Recipe"
dsfgsdgsdfgsdfgsdfgsdfg5g
dfgsdfgsfgsfgsdfgsdfgsdfg435
Again, any code to at least get me started with thetriggerto start
thewritetofilewould be great!
Thanks!- Hide quotedtext-
- Show quotedtext-
I could get the code to work so I tried what I post below and it still
didn't work. I moved some data, but still wasn't getting the stuff
between Recipe and End of Recipe
Dim streamR As StreamReader = IO.File.OpenText("c:\MultiTemp1.txt")
Dim streamw As StreamWriter = IO.File.CreateText("c:
\filtered2.txt")
Dim strInput As String
While Not streamR.EndOfStream
strInput = streamR.ReadLine
If strInput.Contains("End") Then
Else
If InStr(strInput, "Recipe", CompareMethod.Text) >= 0
Then
strInput = streamR.ReadLine
streamw.WriteLine(strInput)
End If
End If
End While
streamw.Flush()
streamw.Close()
streamR.Close()
Thanks for the help you have already given me..do have any other
suggestions? Thanks!