I have a pipe separated text file with 2 lines. I need to remove the CR/LF from the last line in the file. I must do this using the DOS batch script that created the file.
Text file:
Line1has|WWW|This is a note CR/LF <— this are not visible
U|12345 CR/LF <– not visible — need to remove this one
Line1has|WWW|This is a note CR/LF <—need to keep this
U|12345
VBScript:
Const inFilePath = “something.psv”
Const outFilePath = “out.psv”
With CreateObject(“Scripting.FileSystemObject”)
Set inFile = .OpenTextFile(inFilePath)
Set outFile = .OpenTextFile(outFilePath, 2, True)
End With
outFile.WriteLine inFile.ReadLine
outFile.Write inFile.ReadLine