LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-11-2008, 01:54 PM   #1
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Rep: Reputation: 15
Text Editors


Please help educate an old Scotsman.

What is the difference between the file formats of a plain text file in Linux and in Windows? For example, if I create a file using, say gedit in Fedora and then look at it in kwrite, everything is fine. If I look at it in Windows Notepad, all the CR/LF line endings seem to have disappeared and I get a fairly difficult to follow jumble of text.

John
 
Old 04-11-2008, 02:07 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
That is because Windows use a different character for carriage return than Linux and Unix in general uses. Your best bet is to use a decent text editor in Windows, such as Scite, Notepad2, Texpad, Ultraedit or Notepad++. Remember that Notepad has not been update in years, pretty much like IE6 and should be avoided at all costs.
 
Old 04-11-2008, 02:33 PM   #3
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Original Poster
Rep: Reputation: 15
Thanks for the information and suggestion.

My reason for asking is that from time to time I want to cut and paste data between Linux and Windows and I have noticed that a Windows text file seems to be fine in Linux but not the reverse.

I was labouring under the naive assumption that the concept of an ASCII file with lines terminated by CR/LF hadn't changed since the days of DOS Version 2.0. I'll see what I can find for an editor when I'm on the wrong side of the wire!

Thanks again.

John
 
Old 04-11-2008, 03:16 PM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
*Nix has tool called dos2unix/unix2dos (or tofrodos) to translate from nix format to windows format and back.
 
Old 04-11-2008, 03:38 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by John-in-France View Post
Thanks for the information and suggestion.

My reason for asking is that from time to time I want to cut and paste data between Linux and Windows and I have noticed that a Windows text file seems to be fine in Linux but not the reverse.

I was labouring under the naive assumption that the concept of an ASCII file with lines terminated by CR/LF hadn't changed since the days of DOS Version 2.0. I'll see what I can find for an editor when I'm on the wrong side of the wire!

Thanks again. :study:

John
Wordpad actually does the trick. And yes, DOS (and hence Windows)
uses CR/LF, Unix (and hence Linux) is using a LF (has been for almost
40 years, btw ;} - again, DOS is the deviation), and the Mac uses CR ...


Cheers,
Tink
 
Old 04-11-2008, 03:46 PM   #6
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Original Poster
Rep: Reputation: 15
Thanks Tinkster,

You're right - my test file (a Grub Menu) which looked terrible in Notepad looks fine in Wordpad so all that hunting for Scite - it took all of ten minutes! - was unnecessary. Funny, somehow I think that my editing in Windows will use Scite rather than Wordpad - I want a Text Editor, not a baby Word Processor. :-)

John
 
Old 04-11-2008, 03:51 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Heh. No worries, glad you found Scite ;}
You could have installed cygwin and used the venerable VIM, too ;D


Cheers,
Tink
 
Old 04-12-2008, 03:12 AM   #8
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Original Poster
Rep: Reputation: 15
Eekk! Tinkster Please don't suggest VIM.

I absolutely hate VIM - I've never been able to get my head round using it even for things when you have to like visudo! I'm sure there must be a way of shifting the editor default away from VIM and when I figure it out....

John
 
Old 04-12-2008, 03:41 AM   #9
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Quote:
Originally Posted by John-in-France View Post
Eekk! Tinkster Please don't suggest VIM.

I absolutely hate VIM - I've never been able to get my head round using it even for things when you have to like visudo! I'm sure there must be a way of shifting the editor default away from VIM and when I figure it out....

John
To change the editor used with visudo, ensure that you have the EDITOR environment variable set to you favorite editor, example:

Code:
export EDITOR=gedit
sudo visudo
 
Old 04-12-2008, 06:04 AM   #10
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Disillusionist View Post
To change the editor used with visudo, ensure that you have the EDITOR environment variable set to you favorite editor, example:

Code:
export EDITOR=gedit
sudo visudo
Ta! - sorted - John
 
Old 04-12-2008, 11:29 AM   #11
cizzi
Member
 
Registered: Jun 2001
Distribution: Gentoo
Posts: 153

Rep: Reputation: 19
You might also want to check out pico text editor if you're comming from windows and are new to linux, so when you hit the backspace key it actually does a backspace vs ESC,x in vi.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHCE on text editors Jzarecta Linux - Certification 8 07-18-2007 01:38 PM
text editors gballsch SUSE / openSUSE 4 09-16-2006 01:15 PM
what are the 'best' text editors (for C, html, js, etc) name_in_use450 Linux - General 4 08-31-2004 08:01 AM
GUI vs text editors R00ts Programming 9 07-20-2004 05:01 AM
Text editors Penguin Dropout Programming 6 06-16-2003 10:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:05 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration