I have a VBScript file that I leave on my Desktop.
Unix has one variation. Some Windows files (like
Word docs) have another variation. The standard in
Windows is to end the line with ASCII characters
13-10. (Carriage return - line feed)
If you paste the following text to Notepad and save
it as a .vbs file, you can just drop any file onto it and
have it fixed. (Note that in some cases on XP you
may need to adjust security to run a .vbs file.)
'---------------- start text of vbs file ------------
Dim fso, ts, s, arg, fil, fpath, s1
Set fso = CreateObject("Scripting.FileSystemObject")
arg = WScript.arguments.item(0)
Set ts = fso.OpenTextFile(arg, 1, False)
s = ts.ReadAll
ts.Close
Set ts = Nothing
s1 = Replace(s, vbCrLf, vbCr, 1, -1, 0)
s1 = Replace(s1, vbLf, vbCr, 1, -1, 0)
s1 = Replace(s1, vbCr, vbCrLf, 1, -1, 0)
Set ts = fso.CreateTextFile(arg, True)
ts.Write s1
ts.Close
Set ts = Nothing
Set fso = Nothing
MsgBox "All done", 64, "File fixed"
' -------- end vbs file ---------------
Another variation, if you want to save the edited text
to a different file, replace the line:
Set ts = fso.CreateTextFile(arg, True)
with:
Set ts = fso.CreateTextFile(arg & ".txt", True)