#!/usr/local/bin/perl #routine for extracting amount of time for each Legato Networker Group Backup ############################################################################ ## use Date::Manip qw (ParseDate DateCalc); open (LOG, "/nsr/logs/savegrp.log") or die "something went wrong:$! \n"; print " Total Elapsed Time for Each Saved Group \n"; print " Legato Networker \n\n"; while (<LOG>) { if (/^Networker/i) {print $_} if (/^Start/i) { $Start = $_; print $Start; } if (/^End/i) { $End = $_; print $End; ($sName, $sTime, $sday, $smonth, $sdate, $stime, $syear) = split (' ', $Start); ($eName, $eTime, $eday, $emonth, $edate, $etime, $eyear) = split (' ', $End); $startDate = ParseDate("$sday, $smonth, $sdate, $stime, $syear"); $endDate = ParseDate("$eday, $emonth, $edate, $etime, $eyear"); print "Elapsed time:"; print DateCalc($startDate, $endDate), "\n\n"; } } close (LOG); -----Original Message----- From: Williams, P. Lane (BIS) Sent: Wednesday, May 16, 2001 4:06 PM To: '[EMAIL PROTECTED]' Subject: FW: logfiles I was wondering if anyone could help? I would like to read information from a logfile and then calculate the dates to get the backup time for each group. I understand how I can get the start and stop time for each group but how would I use that information to get the calculated backup time. I am probably going about this wrong???? I placed the script and the output below. Thanks, Lane #!/usr/local/bin/perl #use Date::Manip qw (ParseDate DateCalc); open(LOG, "/home/willipl1/savetest.log") or die "something is wrong:$!\n"; while (<LOG>) { print if /\bNetworker\b/i; print if (/\bStart\b/i + /\bEnd\b/i); #print "total backup time for group:"; } close(LOG); #$startDate = ParseDate (""); #$endDate = ParseDate(""); #print DateCalc($startDate, $endDate); OUTPUT: NetWorker Savegroup: (notice) wkstninc completed, 1 client(s) (All Succeeded) Start time: Thu May 10 11:28:30 2001 End time: Thu May 10 11:51:53 2001 NetWorker Savegroup: (notice) wkstninc completed, 1 client(s) (All Succeeded) Start time: Thu May 10 15:02:51 2001 End time: Thu May 10 15:03:54 2001 NetWorker Savegroup: (notice) wkstninc completed, 1 client(s) (All Succeeded) Start time: Thu May 10 15:14:01 2001 End time: Thu May 10 15:14:28 2001 NetWorker Savegroup: (notice) wkstninc completed, 2 client(s) (All Succeeded) Start time: Fri May 11 14:26:42 2001 End time: Fri May 11 16:05:34 2001 NetWorker Savegroup: (notice) wkstninc completed, 2 client(s) (All Succeeded) Start time: Fri May 11 16:36:39 2001 End time: Fri May 11 16:45:52 2001 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 16, 2001 10:17 AM To: [EMAIL PROTECTED] Subject: logfiles Has anyone ever had to extract a date from a text logfile, calculate the difference between two dates and then output the results? I am using Legato Networker and need to extract the start and stop times for group backups and output the total time for each group. the date format is as follows: Start time: Thu May 10 11:28:30 2001 End time: Thu May 10 11:51:53 2001 Thanks, Lane If you wish to unsubscribe, send an e-mail to: [EMAIL PROTECTED] ==^================================================================ EASY UNSUBSCRIBE click here: http://topica.com/u/?bz8Qae.bAuubb Or send an email To: [EMAIL PROTECTED] This email was sent to: [EMAIL PROTECTED] T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01 ==^================================================================ _______________________________________________ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users