LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   text files written in linux lose format in windows? (http://www.linuxquestions.org/questions/linux-general-1/text-files-written-in-linux-lose-format-in-windows-928393/)

michaelinux 02-08-2012 07:42 PM

text files written in linux lose format in windows?
 
Sometimes i have to write small text files in linux using kate, nano or any other text editor, i save them in a separate partition so i can access to them from windows, but when i open my files, all the text appears in one line. Same thing happens with source code files, sometimes i have to share code with friends and when they open the file is just a mess in one line with no spaces.
is there something i can configure so the format stays the same?

frankbell 02-08-2012 07:48 PM

This seems to have to do with Linux/Unix and Windows using different end-of-line character formats.

Searching for "convert text file linux to windows" turned up lots of stuff.

This seemed to be one of the clearer ones: http://www.cyberciti.biz/faq/convert...ows-textfiles/

sundialsvcs 02-09-2012 05:00 AM

Look at commands such as unix2dos and of course dos2unix for information about the "end of line" issue, but this may or may not be your problem.

The "end of line issue" is that the end of a line in a text-file might be denoted, variously, by the CR character ("carriage return"), the LF character ("line feed"), or some combination of the two.

But, in general, files can "lose their formatting" simply because the word-processor in question does not understand the file's format. If you're using, say, the ubiquitous Microsoft Word, this program has many file-format recognition and conversion filters that may or may not be installed by default but that can be installed with Add/Remove Programs or by dialogs within the application itself. Working the problem the other way, some Linux-based tools can save files in more palatable-to-Word formats.

As for myself, I got tired of buying Microsoft licenses and I simply use OpenOffice in both places. Works fine. I don't feel "slighted" and I don't feel "cheap," but it so happens that OO (which now has "Bill's favorite nemesis and contract Bridge partner, Larry Ellison," behind it) does everything that I need to do such that I really don't notice the difference.

catkin 02-09-2012 05:17 AM

Alternatively WordPad, MS Word, LibreOffice Writer etc. display *n*x format files OK in Windows (no good for editing code though).

lithos 02-09-2012 06:46 AM

Hi,

Try using PSPad or Notepad++ on your windows machine to open the files from linux.

You can also then save them to linux format to make them readable on server again.

catkin 02-09-2012 09:46 AM

Quote:

Originally Posted by lithos (Post 4597993)
You can also then save them to linux format to make them readable on server again.

How do you do that with notepad++? I netsearched for it last night but did not find the answer.

lithos 02-09-2012 01:11 PM

2 Attachment(s)
Quote:

Originally Posted by catkin (Post 4598137)
How do you do that with notepad++? I netsearched for it last night but did not find the answer.

Maybe you searched for this ?
Menu - Edit / EOL Conversion ...

(see att. pic)

Although PSPad has it more visible : Menu / Format: DOS/UNIX/MAC (pic 2)

catkin 02-09-2012 09:09 PM

Quote:

Originally Posted by lithos (Post 4598290)
Maybe you searched for this ?
Menu - Edit / EOL Conversion ...

(see att. pic)

Exactly what I was looking for. Thanks lithos :)

weibullguy 02-09-2012 09:39 PM

I'll throw (g)Vim and Geany on the list of editors that allow you to set the EOL character. I use both on Linux and Windows when I need to share files. It's nice to work on code on both platforms without having to worry about trivial things like EOL characters. Especially since the EOL character appears as a change to Subversion (IIRC).


All times are GMT -5. The time now is 04:37 PM.