Click here to get back home

sorting

 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
sorting Luthor 07-07-2005
`--> Re: sorting Gunnar Hjalmars...07-07-2005
Get Chitika Premium
Posted by Luthor on July 7, 2005, 5:04 am
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 Gunnar Hjalmarsson on July 7, 2005, 7:17 am
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
Sorting November 28, 2004, 10:43 pm
Sorting June 7, 2007, 4:44 am
Sorting an Array by Another January 21, 2005, 12:56 pm
sorting a structure May 5, 2005, 3:22 pm
Hash Sorting June 14, 2005, 2:49 pm
table sorting May 3, 2006, 5:58 pm
Sorting EBCDIC December 15, 2006, 11:48 am
Sorting Hash by Value and Key May 17, 2007, 9:57 am
sorting multiple arrays November 11, 2004, 3:33 am
Sorting a hahs of hashes January 24, 2005, 11:19 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap