Click here to get back home

Preserve Timestamp

 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
Preserve Timestamp pulsar4f 01-21-2005
Posted by pulsar4f on January 21, 2005, 1:34 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 Anno Siegel on January 21, 2005, 9:58 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 chris-usenet on January 24, 2005, 10:01 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
GD - way to preserve PNG transparency? January 5, 2006, 2:51 am
preserve case using s/ operator July 29, 2005, 1:06 pm
Stupid Q: How to preserve numeric characters August 29, 2006, 2:11 am
FAQ 5.23: How do I get a file's timestamp in perl? December 19, 2004, 12:03 am
FAQ 5.23: How do I get a file's timestamp in perl? December 25, 2004, 12:03 am
FAQ 5.24 How do I set a file's timestamp in perl? January 31, 2005, 12:03 am
FAQ 5.23 How do I get a file's timestamp in perl? February 15, 2005, 6:03 pm
FAQ 5.25 How do I set a file's timestamp in perl? April 27, 2005, 11:03 am
FAQ 5.24 How do I get a file's timestamp in perl? May 15, 2005, 5:03 am
FAQ 5.25 How do I set a file's timestamp in perl? July 13, 2005, 4: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