Click here to get back home

Diff Files contaning regex pattern string

 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
Diff Files contaning regex pattern string Michael Yang 05-13-2007
Get Chitika Premium
Posted by Michael Yang on May 13, 2007, 11:27 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
Diff files with regex comparing May 13, 2007, 11:40 am
replace string contaning \n November 13, 2007, 4:46 am
pattern serach over many files February 15, 2007, 6:13 am
get the matching regex pattern March 20, 2008, 9:16 am
How to do pattern matching for multiple files in Perl August 28, 2007, 9:23 am
Dynamic data within regex pattern? October 1, 2004, 1:53 pm
split()'s regex pattern parameter March 30, 2006, 2:27 pm
$string =~ /$pattern/i September 12, 2007, 7:53 pm
Matching neighbouring words of a pattern using Regex August 30, 2004, 4:45 pm
multiple regex pattern matching per line? September 4, 2004, 2:24 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap