Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
24
rated 0 times [  24] [ 0]  / answers: 1 / hits: 23143  / 1 Year ago, tue, april 4, 2023, 12:03:11

Sometime I have to use the text files created in Ubuntu, using editors, in Windows editors. So basically when ever I create a text file in Ubuntu I append the extension .txt, and it does make the file open in Windows very easily.



But the actual problem is the text files created in Ubuntu are so difficult to understand (read) when opened in Windows' Notepad. No matter how many lines have been used, all the lines appear in the same one line.



Is there a easy way to save the text files in Ubuntu's basic editors so that it can be seen exactly the same in Windows' notepad?


More From » text-editor

 Answers
6

Unlike Unix where a new line is represented by a LF character we need a combination CR/LF for files in DOS/Windows:



Gedit



We can let Gedit save text documents with Windows-style line endings in the File -> Save as dialog.




  • Adjust the settings for Line Endings in the drop down menu to Windows.



    enter image description here




Nano



To make nano write text files in DOS format we have to run it with the following command line option 1:



nano --dos <filename>


Vim



Vim can convert files from Unix to DOS format with the following control sequences 2 :



:update
:e ++ff=dos
:w


Emacs



To set the buffer coding to DOS style issue Meta + x :



set-buffer-file-coding-system utf-8-dos

[#28433] Wednesday, April 5, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ardingiba

Total Points: 497
Total Questions: 95
Total Answers: 109

Location: Gabon
Member since Sat, Jan 15, 2022
2 Years ago
;