Click here to get back home

string sort()

 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
string sort() Chris 02-12-2005
|--> Re: string sort() Gunnar Hjalmars...02-12-2005
Posted by Chris on February 12, 2005, 4:14 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 February 12, 2005, 5:24 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 Jürgen Exner on February 12, 2005, 7:06 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
Sort Part of a string July 16, 2004, 1:47 am
numeric sort on string like a123-3 July 18, 2006, 2:01 pm
can Perl Sort do this, unix sort breaks on it (muliple spaces as demiliter) February 2, 2005, 6:08 pm
Re: A Sort Optimization Technique: decorate-sort-dedecorate August 30, 2006, 4:32 pm
Counting occurances of string A in string B, and adding it to string B August 3, 2004, 1:53 pm
Perl ActiveX: A VBA string passed to my control is treated as a doubel-quoted string October 9, 2006, 4:03 pm
How to convert string to an expression in PERL or calculating numerical string November 23, 2005, 5:03 am
Search a Text File for a String, Return String to Function July 29, 2006, 12:19 pm
[Q]: How to sort first abc, then 123? March 12, 2005, 7:16 pm
sort? May 24, 2007, 1:02 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap