LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-08-2012, 07:42 PM   #1
michaelinux
Member
 
Registered: Apr 2009
Location: El Salvador
Distribution: Slackware -current
Posts: 166

Rep: Reputation: 17
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?
 
Old 02-08-2012, 07:48 PM   #2
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, Mint
Posts: 7,402

Rep: Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403
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/
 
Old 02-09-2012, 05:00 AM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,257

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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.

Last edited by sundialsvcs; 02-09-2012 at 05:03 AM.
 
Old 02-09-2012, 05:17 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Alternatively WordPad, MS Word, LibreOffice Writer etc. display *n*x format files OK in Windows (no good for editing code though).
 
Old 02-09-2012, 06:46 AM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 02-09-2012, 09:46 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by lithos View Post
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.
 
Old 02-09-2012, 01:11 PM   #7
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by catkin View Post
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)
Attached Images
File Type: jpg notepad++-CR_LF.jpg (35.3 KB, 6 views)
File Type: jpg PSPad-CR_LF.jpg (41.1 KB, 4 views)
 
1 members found this post helpful.
Old 02-09-2012, 09:09 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by lithos View Post
Maybe you searched for this ?
Menu - Edit / EOL Conversion ...

(see att. pic)
Exactly what I was looking for. Thanks lithos
 
Old 02-09-2012, 09:39 PM   #9
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,701
Blog Entries: 1

Rep: Reputation: 219Reputation: 219Reputation: 219
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).

Last edited by weibullguy; 02-09-2012 at 09:42 PM.
 
  


Reply

Tags
files, linux, text, windows 7


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows chkdsk deletes files written by Ubuntu on an NTFS partition chekhov_neo Linux - Newbie 6 11-23-2011 09:38 PM
Automatically saving text files in DOS format ciden Linux - Newbie 2 10-05-2010 11:48 PM
Copy text files from linux to windows Idiosyncra3y Linux - Newbie 11 06-08-2010 01:42 PM
samba - windows files lose "created on" date stamp when moved to samba share on linux jaredk51 Linux - Software 5 02-19-2010 03:13 PM
windows can't see the files written by linux feetyouwell Linux - Software 10 02-12-2005 07:59 AM


All times are GMT -5. The time now is 01:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration