Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of text files created in Ubuntu and when I access them on a Windows machine using DropBox they are not properly formatted because of the Line Ending difference between Unix/Linux and Windows.

After changing the Line Ending from Unix/Linux to Windows, the text file was rendered properly in both Windows and Ubuntu.

How to convert the Line Ending from terminal to automate the conversion?

share|improve this question
    
Most text editors in Windows can handle Unix line breaks, notepad.exe being the notable exception (even Wordpad can). –  Daniel Beck Jan 7 '13 at 0:14
add comment

2 Answers

On Ubuntu:

$ apt-get install dos2unix
$ unix2dos file.txt

On Windows:

share|improve this answer
add comment

I would suggest the tofrodos package. Converts neatly either way, with todos and fromdos. Available only on the Ubuntu side, I should note.

On the Windows side, my memory is that Wordpad (unlike Notepad) will in fact display files with *nix line endings correctly, which should be a help for viewing files that haven't been converted.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.