Mailinglist Archive: opensuse (2773 mails)
|< Previous||Next >|
[SLE] Re: All lines end with ^M under 21.1.8 and RH 6.1
- From: activex1@xxxxxxx (Sam Carleton)
- Date: Thu, 30 Dec 1999 14:30:36 -0500
- Message-id: <386BB2DC.CDC5C74B@xxxxxxx>
Enlightenment about text files...
DOS (Win xx, OS/2, and compatable OS's) all have both the line feed (LF, ANSI
character 10, 0Ah) and the cartrage return (CR, ANSI character 13, 0Dh) to denote
the end of a line in a text file. Macs only have the CR, and Unix only has the LF.
Why? Same reason does uses the back slash and Unix the forward.slash.
What to do about it? One way of dealing with it to FTP the files correctly. There
is both a binary mode and an ASCII mode to trasfer files. What is the difference,
you might ask... The binary mode trasfers the file EXACTLY as it is from one box to
another, which is what you normally want, but... The ASCII mode will do things like
convert the CRLF to simply LF if the file is going from a DOS system to a Unix
system, and from simply LF to CRLF if going from Unix to DOS.
The program that does the such a conversion is very simple to write, I am sure there
is a utility in Linux to do that for you. One a Sun Sparc station it is dos2unix,
and I would guess unix2dos. There are some "smart" editors, one of them that I like
very much in the DOS world is Boxer (http://www.boxersoftware.com/), that will read
in a text file from DOS, Mac, or Unix and allow you to save in any of the three
formats. I would not be surprized if there are also some Linux editors that can do
the same, again it is a very simply process.
P.S. I will post this message and then take five minutes to write a quick dos2unix
and unix2dos program in C, for those of you that care.
Gary Bankston wrote:
> Matt Braun wrote:
> > I just reinstalled RedHat and xemacs (it was easier than tracking down a
> > weird error) but I'm getting this error with xemacs: all files I read in any
> > mode end with ^M. These are files that I've created in Linux, not just DOS
> > files (even source I got from a friend shows up with ^M). I've looked around
> > and while I've found a similar problem has manifested in shell mode under
> > TCSH (which is my shell), the fix to that problem has no effect on my
> > problem.
> > Strangely, if I create the file from scratch in xemacs, I don't see ^M at
> > the end of the line, so if it's a problem with the files only (for whatever
> > reason), how can I guarantee that xemacs views them properly?
> > Thanks for any help you can offer!
> humm thats interesting as I have the reverse problem under NT. If I open an
> existing text thile and edit it, everything is fine. But if I create a new file
> with xemacs the file ends up with unix style line ends (i.e. just a carriage
> return instead of a carriage return/line feed).
> Unfortunately, I don't know what the solution here, but its driving me nuts. I
> have tried reading through all the documentation, but thats getting me nowhere
> fast as well. I did think it strange that we are both having the opposite
> problem on opposite platforms though.
> /_______\ glary
> \_______/ sandstorm
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
|< Previous||Next >|