[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Apologies for long line length and a newline problem



On Mon, 2004-11-22 at 18:23 +0000, Lesley Anne Binks wrote:
> Was just looking through the archives for something and 
> noticed that I am using very long line lengths on recent 
> postings.

Naughty ;)

> Now in Windows 0x0D 0x0A is the carriage return line feed
> and on Linux boxes I've always understood it's 0x0D only.

No, it's 0x0A only. Windows is "\r\n" (carriage return, then line feed)
and on Unix-type systems it's "\n" (line feed only). I think the Mac
uses a solitary "\r" (carriage return).

> Emacs showed the  newlines not as newlines but as ^M 
> which translates to 0x0D. 

Actually, it's not - it's showing you the \r at the end of every line ;)
If you have something in DOS format (\r\n), that's indistinguishable
from the file with the same contents in Unix format (\n) that has a \r
appended to every line, y'see.

> Anyone else come up against this kind of problem ? What's 
> the fix, bar going through the extracted text files and 
> making the relevant replacements by hand?

perl -p -i.orig -e 's/\r\n/\n/g' *

.... or similar?

Cheers,

Alex.

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.