A third party XML generator creates a XML with only LF, so I have a problem to parse it by awk.
I’m thinking of the way that reading the file by TextInputStream and apply it with ReplaceLineEncodings method, and then run TextOutputStream to save it again.
However, it doesn’t look good.
Looking for a good idea to accomplish this requirement.
That is, is there any way to put CRLF to the specific text file?
I need to modify the statement I wrote. Sorry about that.
The generator creates a text file with only LF, and I couldn’t call the “ReplaceLineEndings” method to convert it.
I can only see the file on filesystem, and need to parse it.
With my text editor, I just see that LF at the end of line so have problem in parsing by awk.
The below code doesn’t look good but it works.
I just read the file and apply ReplaceLineEndings to the file contents, then recreate the file.
Thanks for your help.
Dim readString As String
Dim readf As FolderItem = GetFolderItem(fileName)
Dim f As FolderItem = New FolderItem(fileName,FolderItem.PathTypeAbsolute)
Dim input As TextInputStream = TextInputStream.open(readf)
readString = ReplaceLineEndings(input.ReadAll,EndOfLine.Windows) //Adding LF (CRLF)
If (f <> Nil) Then
Try
Dim t As TextOutputStream = TextOutputStream.Create(f)
t.write(readString)
t = Nil
Catch e As IOException
End Try
Else
End If