On Monday 04 October 2010 14:45:57 Bob McConnell wrote:
> From: Brandon McCaig
>
> > On Fri, Oct 1, 2010 at 8:26 AM, Bob McConnell <[email protected]> wrote:
> >> AKA carriage return, it suggests you have DOS/Windows line endings
> >> instead of Unix. You can clean them up in the source files with the
> >> dos2unix or tr filters. The latter looks something like this:
> >>
> >> $> tr "\r\n" "\n" < bad.pl > good.pl
> >
> > It suggests to me that he has Mac (<=9) carriage returns (\r or 0x0D)
> > only. As far as I can tell, that Perl one-liner he was asked to run
> > should have printed all characters < decimal 31 and greater than
> > decimal 126, of which the 10 or CF in the DOS/Windows newline should
> > have been printed as well. It shouldn't be too difficult to write an
> > equivalent tr for mac2unix though to compensate.
>
> $> tr "\r" "\n" < bad.pl > good.pl
>
> You can also combine them to do either/or. The first pair takes
> priority, but the second pair will pick up any left over carriage
> returns and turn them into extra line feeds.
>
> $> tr "\r\n" "\n" "\r" "\n" < bad.pl > good.pl
>
tr processes one character at a time, so this code won't work.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Parody on "The Fountainhead" - http://shlom.in/towtf
<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/