[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Apologies for long line length and a newline problem
Alex Hudson <home [at] alexhudson.com> wrote :
> 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).
Ahh ok :)
>
> > 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.
Interestingly, I hexdumped the text file on my laptop and
checked it using the binary option under Textpad on Windows.
The original file only has the 0x0D in it, not the 0x0D 0x0A
that I have in some other text files on my XP side.
I also tried the search and replace method mentioned in previous posts, using the 'Enter' button to enter a newline
and that returned ^M so I was unable to solve the problem
thataway. This was done on my laptop which is running
Suse 8.2.
>
> > 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' *
That'll give me something to work on :)
TYVM
Lesley
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.