[SLE] Re: All lines end with ^M under 21.1.8 and RH 6.1
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. Sam 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@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
suse comes with alias for unix2dos and dos2unix..they use the recode command. note that in 6.2, they were broken, and used the wrong syntax for the newer recode command..(actually, maybe it was just a warning about depreciated syntax). alias dos2unix='recode ibmpc..lat1' alias unix2dos='recode lat1..ibmpc' -- ======================================================================== Rocky McGaugh Atipa Linux Solutions Linux Systems Engineer www.atipa.com rocky@smluc.org rmcgaugh@atipa.com ======================================================================== On Thu, 30 Dec 1999, Sam Carleton wrote: -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Sam Carleton wrote:
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.
The reason is that DOS started life as QDOS which was creted while Seattle Computers waited (less than patiently) for CP/M 86. CP/M was based loosely on RT-11 which also used a crlf line terminator and / for options. Using crlf is actually pretty logical as it means that you don't have to have any special handling in the terminal driver, cr alone seems to have no logic at all. The original command.com could use / or \ dependant on a switch, in the former case - was used for options. Many (if not all) versions of msdos accepted both / and \ in their system calls, windows perhaps still does, it has been many years since I cared. /Michael -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
In reply to Sam Carleton's letter who wrote on 30 Dec:
... 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.
Sam, before you get carried away too far, try man mcopy and see what that may do for you :-). Best regards, Alex. -- Dr. Alexander Angerhofer Associate Professor of Chemistry Department of Chemistry The University of Florida Box 117200 Gainesville, FL 32611-7200 USA Tel.: (+1) 352 846 3281 alt.: (+1) 352 392 9489 lab : (+1) 352 846 3283 FAX : (+1) 352 392 0872 -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Alex Angerhofer wrote:
In reply to Sam Carleton's letter who wrote on 30 Dec:
... 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.
Sam,
before you get carried away too far, try man mcopy and see what that may do for you :-).
I will look into mcopy, but like I said it is a quick little program, here it is in C. Simply use this command line to compile it:
cc -o textconv textconv.c
<HR> <UL> <LI>application/x-gzip attachment: textconv.c.gz </UL> N§²æìržzǧué[h²ë)îÅ맲æìržzˬyÊ&ÚuØÚÊ&©Ý²Ç§ué[h²ë)îÅè^.±ç([(rØ^¶m§ÿðÃ.±ç(ô®Š+·ðèïÅ
Alex Angerhofer wrote:
In reply to Sam Carleton's letter who wrote on 30 Dec:
... 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.
Sam,
before you get carried away too far, try man mcopy and see what that may do for you :-).
That man page isn't very clear as to how you specify which format is the input and which the output, i.e., whether you're going dos->unix or unix->dos. It does say that a drive letter implies DOS - but then the man page for mtools references a nonexistent configuration section for an explanation of how to assign drive letters. There's nothing I can see that explains how to assign a drive letter to a mounted hard drive FATpartition. Do you have a better source of information on mcopy/mtools? Paul -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
That man page isn't very clear as to how you specify which format is the input and which the output, i.e., whether you're going dos->unix or unix->dos. It does say that a drive letter implies DOS - but then the man page for mtools references a nonexistent configuration section for an explanation of how to assign drive letters. There's nothing I can see that explains how to assign a drive letter to a mounted hard drive FATpartition.
Do you have a better source of information on mcopy/mtools?
Paul: try: http://www.tux.org/pub/knaff/mtools/mtools_toc.html which is probably the more up-to-date version of the manual. Hope this helps, Alex. -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
participants (6)
-
abrahams@mbs.valinet.com
-
activex1@one.net
-
alex@chem.ufl.edu
-
alex@physical36.chem.ufl.edu
-
Michael.Salmon@uab.ericsson.se
-
rmcgaugh@atipa.com