#!/usr/bin/perl use Time::Local; # FILE READ IN $log_file = './raw.txt'; open(FH, '<', $log_file) or die $!; while () { if(m/START/) {chomp; $sdname = $_;} if(m/notBefore/) { chomp; ($notB1, $notB2) = split('=', $_); $notB2 =~ tr/:/ /; my($mon,$mday,$hour,$minute,$sec,$year)=split(/ /,$notB2); #print $mon, $mday, $hour, $minute, $sec, $year; $time_1 = timelocal($sec,$minute,$hour,$mday,$mon,$year); } if(m/notAfter/) { chomp; ($notA1, $notA2) = split('=', $_); $notA2 =~ tr/:/ /; my($mon,$mday,$hour,$minute,$sec,$year)=split(/ /,$notA2); $time_2 = timelocal($sec,$minute,$hour,$mday,$mon,$year); } if(m/END/) {printf("%s %s %s\n", $sdname, $notB2, $notA2); print $time_2,"\n",$time_1, "\n"; $diff_time = $time_2 - $time_1; $diff_time1 = ($diff_time/86400); print "diff_time :$diff_time:$diff_time1:\n"; } }