Click here to get back home

Cut the last invisible spaces from the words

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Cut the last invisible spaces from the words Dave 11-25-2004
Posted by Dave on November 25, 2004, 5:22 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by Dave on November 25, 2004, 5:39 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
Help: separate difference length of spaces between words November 24, 2004, 11:19 pm
replace multiple spaces between words with single space. March 14, 2005, 12:40 pm
Invisible cache for LWP / Mechanize? January 28, 2005, 2:20 am
discover invisible characters June 10, 2008, 3:10 pm
discover invisible characters June 10, 2008, 3:12 pm
Invisible variables in Perl debugger February 3, 2005, 6:13 am
Invisible variables in Perl debugger II May 30, 2005, 2:31 am
How to make perl code invisible to the User? April 24, 2006, 11:32 pm
Replacing spaces September 19, 2004, 3:39 am
spaces in paths August 29, 2005, 2:09 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap