Click here to get back home

Calculating time of employee session from the log date/time stampusing perl

 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
Calculating time of employee session from the log date/time stampusing perl Jayesh Kamdar 05-24-2005
Posted by Jayesh Kamdar on May 24, 2005, 5:55 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 Sherm Pendley on May 24, 2005, 7:03 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 Gunnar Hjalmarsson on May 25, 2005, 3:08 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
CGI::Session How can a session be not expired and at the same time empty? June 14, 2007, 3:56 pm
The following week, Graham Cluley - a colleague and employee of Solomon March 30, 2006, 7:23 pm
Perl for calculating an expression. July 23, 2008, 12:36 am
Getting Perl to ignore Letters when calculating numbers. March 30, 2005, 9:54 pm
setting of session values from a script for the same session in which it is running May 23, 2005, 12:35 am
new CGI::Session creates a new session every visit. GRRR!!! March 15, 2007, 6:43 pm
GMT time to local time, according to timezone and summer/winter time. May 15, 2005, 10:45 pm
CGI:Session porting to Apache:Session June 25, 2005, 10:31 pm
creating a new session when a session is expired May 17, 2006, 8:21 am
How to convert string to an expression in PERL or calculating numerical string November 23, 2005, 5:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap