Misleading tr example? Edit

The example reads tr -d '\r'. However, this will remove all \r's including those in the middle of the line. Of course, \r's should probably not be placed in the middle of the line in a text file so it may be the same thing.

BTW, this can be written in Perl as:


Instead of:



Yes, I know it will remove all \r's, and I agree that they shouldn't be placed in the middle of the line, so removing all \r's isn't a problem.
Thanks for pointing out a better way of writing it in Perl. I have changed it to what you suggested, but I have not tested it (Don't have access to Perl where I am now). Anyway, this article is just a start, and I intend to collect lots of examples here. If you have any ideas about new examples or corrections to the existing, don't be afraid to edit the article:) Ahy1 10:56, 22 July 2006 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.