PDA

View Full Version : Whats the diffrence of txt file between under win and linux?



margaritaville
02-01-2004, 11:59 PM
Whats the diffrence of txt file between under win and linux?
ANd how can i convert them from one to the other???
Thank you.

Li Gwai Lo
02-02-2004, 12:45 AM
Windows ends each line with a CR-LF (0x0D 0x0A), while the civilized world just uses a LF (0x0A). Easiest way I know is to use VI on the file, and type

:%s/^V^M//

(that's "ctrl-V ctrl-M" -- the ctrl-M (0x0D) will actually show up because the ctrl-V puts VI in verbatim mode)

then do a :wq

There's probably a simpler filter using SED. Oh well. Works for me.

fingers99
02-02-2004, 03:48 AM
If you don't like the vim way, there are also:

dos2unix

and

unix2dos

from the command line. They're both very easy to use.