Click here to get back home

difference between two files

 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
difference between two files Hendrik Maryns 04-01-2005
Posted by axel on April 3, 2005, 6:04 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 Todd W on April 2, 2005, 11:15 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
trouble merging files using nested loop to read files October 14, 2006, 6:56 pm
What is the difference between if( -f $f ) and unless( -d $f )? October 25, 2004, 8:07 pm
difference between $ and @ March 14, 2008, 3:08 am
How to convert MetaStock formatted files into ASCII files January 9, 2006, 8:02 pm
FAQ 8.46: What's the difference between require and use? December 18, 2004, 12:03 pm
Difference between redirects January 22, 2005, 1:16 pm
FAQ 8.46 What's the difference between require and use? March 23, 2005, 12:03 pm
FAQ 8.46 What's the difference between require and use? June 5, 2005, 11:03 am
FAQ 8.46 What's the difference between require and use? September 29, 2005, 4:03 am
FAQ 8.46 What's the difference between require and use? January 30, 2006, 12:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap