Click here to get back home

Date formatting

 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
Date formatting Ted 06-28-2006
`--> Re: Date formatting Bart Van der Do...06-29-2006
Get Chitika Premium
Posted by Ted on June 28, 2006, 12:26 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 Bart Van der Donck on June 29, 2006, 7:26 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
file name and FTP problem formatting date! Please Help! August 2, 2005, 7:34 am
Newbie help with telephone number and date formatting December 12, 2007, 6:10 pm
update: timezone offset calc and date formatting April 8, 2005, 1:32 pm
using perl to print yesterday's date, but with formatting options ? October 31, 2005, 5:57 pm
Date Manipulation: Week_Number back to Date February 1, 2005, 7:20 pm
Finding date 1 day earlier than a given date! September 8, 2004, 10:07 am
how to get tomorrow date using Date::CALC September 1, 2005, 7:19 am
pod and formatting? January 18, 2005, 8:49 pm
About formatting April 30, 2005, 7:20 pm
GD Graph Pie Formatting November 30, 2004, 11:56 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap