#!/usr/bin/perl # A script to analyse the blip in graph 1.5 # Author: Ian Hickman use strict; use Time::Local; # read in first line and initialise some variables my (@field, @lastfield, %table, $key); my ($timediff, $lasttime, $lastuser); $_=; @field=split; $lastuser=$field[0]; $_=@field[3]; my ($day, $month, $year, $hour, $min, $sec)=/.(\d\d).(\w+).(\d{4}).(\d\d).(\d\d).(\d\d)/; my $time=timelocal( $sec, $min, $hour, $day, $month, $year ); $lasttime=$time; # loop through all lines while( ){ @lastfield=@field; @field=split; $_=$field[3]; ($day, $month, $year, $hour, $min, $sec)=/.(\d\d).(\w+).(\d{4}).(\d\d).(\d\d).(\d\d)/; $time=timelocal( $sec, $min, $hour, $day, $month, $year ); # if same user still clicking if( $field[0] eq $lastuser ){ # calculate time between clicks $timediff=$time-$lasttime; if( $timediff eq "17" ){ print"@lastfield\n"; } # update lasttime $lasttime=$time; # if time is negative ignore it # this occurs due to the way the records were sorted } else { # else user finished session $lastuser=$field[0]; $lasttime=$time; } }