Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 1996 09:51:40 -0700
From:      patl@asimov.volant.org
To:        hmmm@alaska.net, kuku@gilberto.physik.rwth-aachen.de
Cc:        jsigmon@www.hsc.wvu.edu, randyd@nconnect.net, questions@FreeBSD.org
Subject:   Re: MS-DOS text files in UNIX
Message-ID:  <9610101651.AA27996@asimov.volant.org>

next in thread | raw e-mail | index | archive | help
|>  hmmm writes:
|>  > On Tue, 24 Sep 1996, Jeremy Sigmon wrote:
|>  > 
|>  > > >    I've read numerous things about adding the CR-LF back into text files
|>  > > > for use with DOS, but what about the other way?? Is there a way to
|>  > > > remove
|>  > > > that annoying ^M from a DOS text file under FBSD?  I've tried many
|>  > > > things
|>  > > > but nothing short of removing them one-by-one seems to work.  
|>  > 
|>  > apple/mac uses CR
|>  > dos/win   uses LF/CR
|>    dos/win uses CR/LF
|>    VMS     uses CR/LF
|>  > unixes    use  LF

No, actually unix uses NL (New Line), not LF (Line Feed).  It just happens
that they both have the same encoding.  The difference is in interpretaton
and goes back to the ASCII standards of the late 60's.  According to the
standard (which at that time was based on printers and printing terminals),
CR means go to the beginning of the current line, LF means move to the
current horizontal position in the next line, and NL means move to the
beginning of the next line.  LF and NL have the same encoding primarily
because devices built to an earlier version of the standard disagreed on
how that code should be interpreted.  (The earlier standard was unclear
on that detail.)

In any case, CR/LF, LF/CR, and NL are all legitimate standard end-of-line
indicators.  The Apple CR is not.  Unix chose NL for brevity and clarity.
(Otherwise what does a lone LF or CR mean in the midst of a text file?)
MS-Windows uses CR/LF because MS-DOS used CR/LF because CP-M used CR/LF.
I don't know why CP-M used CR/LF; but if I had to guess, I would suspect
that the original developer(s) were using a printer that subscribed to
the CR/LF interpretation.



-Pat
P.S.	Yes, I know that this reply is -way- late; but I just got the cycles
	to catch up on this mailing list for the first time in weeks...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9610101651.AA27996>