From: Brandon McCaig > On Fri, Oct 1, 2010 at 8:26 AM, Bob McConnell <r...@cbord.com> 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 > > (I reserve the right to be completely wrong) Sorry, you can't have that. It already belongs to me. B^) Bob McConnell -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/