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

Re: [FWP] japh



On Wed, Feb 14, 2001 at 12:09:25PM -0400, Joey Mitchell Comeau wrote:
> 
> 
> perl -e 'print" " x15 ."rl Hacker,\x0d"." "x5 ."Another Pe\x0dJust\n"'
> 
> 
> This stems from an annoying file I had to parse this morning, with an 0d
> at the end of every line. I couldn't figure out what the hell was wrong
> with the output. 
> 	What is 0d for, anyway?

\x0d is a carriage return, aka \r.  It means 'return to the beginning of
the current line'.

Windows uses \r\n as a line terminator, whereas Unix uses \n.


You can remove carriage returns in Unix with:

perl -pi -e 'tr/\r//d';


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe