Click here to get back home

comparing modification times of 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
comparing modification times of files Nomen Nescio 09-13-2006
Posted by Nomen Nescio on September 13, 2006, 11:10 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 Brian McCauley on September 13, 2006, 2:13 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
comparing two times using Date::Manip November 29, 2006, 9:10 am
Comparing XML files August 8, 2005, 6:22 pm
Comparing two files January 15, 2008, 3:55 pm
Comparing two files April 7, 2008, 6:07 pm
Comparing huge XML Files February 23, 2005, 1:14 am
Comparing 2 XML files need some suggestions please April 15, 2005, 7:14 am
Diff files with regex comparing May 13, 2007, 11:40 am
Parsing two files and comparing the first fields.. November 28, 2007, 6:12 pm
Modification of a read-only value attempted February 14, 2005, 11:17 pm
File Modification Date September 14, 2005, 12:01 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap