Click here to get back home

Need RegExp

 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
Need RegExp Indigo5 11-15-2004
`--> Re: Need RegExp John W. Krahn11-16-2004
Posted by Indigo5 on November 15, 2004, 7:32 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 John W. Krahn on November 16, 2004, 11:28 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
looking for a better regexp November 25, 2004, 6:35 pm
RegExp Help December 6, 2004, 8:16 pm
RegExp Help December 6, 2004, 3:57 pm
regexp February 23, 2005, 4:29 pm
UTF-8 in regexp with 5.8.1 April 10, 2005, 8:22 pm
Help with regexp. Can you do better September 27, 2005, 5:24 am
regexp May 9, 2006, 9:43 am
Regexp help. June 2, 2006, 9:57 am
regexp January 30, 2007, 6:30 am
Qu: REGEXP February 10, 2007, 1:48 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap