Subject: Re: CRLF fun stuff again...
From: Carsten Neumann (deltor@snafu.de)
Date: Sun Feb 04 2001 - 19:44:32 EST
On Sun, 04 Feb 2001, Tom Watson wrote:
> On Sat, 3 Feb 2001 14:54:13 -0500 (EST), 
> 	Duncan Sinclair <sinclair@dis.strath.ac.uk> writes:
> > 
> > Marc Miller writes:
> <<<Marks deletia about why not>>>
> > 
> <<<Duncan's deletia about why it should work>>>
> > 
> > 
> > Duncan.
> > 
> 
> Geez folks, how about making a "simple" script like:
> 
> #!/bin/sh
> tr "\015\012" "\012\015" $1 $$converted
> rm $1
> mv $$converted $1
This one has some disadvantages:
1. My (gnu-)tr only reads from stdin and writes to stdout.
2. The file-name must not contain spaces - but Mac-files often do.
3. The permissions and dates are changed.
A better one:
#!/bin/sh
tr '\r\n' '\n\r' < "$1" > $$converted
touch --reference "$1" $$converted
chmod --reference "$1" $$converted
mv -f $$converted "$1"
> 
> 
> And put it somewhere nice (/usr/local/bin) and give it a nice name.  It will
> convert to & from mac endings (<cr>, \015) to Unix/Linux/HP-UX endings (<lf>,
> \012).
> 
> If your favorite editor doesn't see the line endings, convert it, and then
> use it, then convert it back.  This isn't rocket science.  Anyway, HTML
> could care less about line endings anyway.  Be thankful you don't have
> Windoze, they use TWO characters as line endings.
> 
> Further rant deleted by author.  It has been said all before.  No use
> wasting bandwidth.  (*SIGH*)
> -- 
> Tom Watson         Generic short signature
> tsw@johana.com     (I'm at home now)
Regards
        Carsten
This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:31 EDT