#!/usr/local/bin/perl -w $plotymax = 1E-10; $plotymin = 1E-05; $temp = $$; $GNU = "/usr/local/gnu/bin/gnuplot"; $gps2_log = 'gps.log'; $start_day = 01; $start_month = 'Mar'; $end_day = 11; $end_month = 'Apr'; %months = qw{Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06 Jul 07 Aug 08 Sep 09 Oct 10 Nov 11 Dec 12}; $sdate_cursor = [$months{$start_month},$start_day,0,0,0]; $edate_cursor = [$months{$end_month},$end_day,23,59,59]; $date_cursor = [0,0,0,0,0] unless(defined($date_cursor)); open(CLOCK,"$gps2_log") or die "$gps2_log not available: $!\n"; open(GPSmk4,">>/tmp/gpsmk4.dat"); while($line = ) { next if $line =~ /last/; ($month,$day,$time) = ( split(/\s+/,$line) )[0..2]; ($hour,$min,$sec) = split(':',$time); $month = sprintf "%02d", $months{$month}; $day = sprintf "%02d", $day; $data3 = ( split(/\s+/,$line) )[6]; last if (compare_dates([$month,$day,$hour,$min,$sec], $edate_cursor) > 0); if (compare_dates([$month,$day,$hour,$min,$sec], $sdate_cursor) > 0) { if( $data3 > $plotymax ) { $plotymax = $data3; } if( $data3 < $plotymin ) { $plotymin = $data3; } print GPSmk4 "$month-$day $time $data3\n"; } # update the date cursor $date_cursor = [$month,$day,$hour,$min,$sec]; } #end of while close(CLOCK); print "$plotymin $plotymax\n"; @files = `ls -1 /tmp/*gps*.dat`; chomp(@files); $plotline = join('', 'plot', join "\,", map { " \"$_\" using 1:3" } @files); ######### Make GIF ######### open(GNUPLOT,">/tmp/$temp-gps.plt"); print GNUPLOT <$$b[$_]) { return 1; } elsif ($$a[$_]<$$b[$_]) { return -1; } } return 0; } #-------------------- ##################### GPS.LOG sample input Jan 1 00:29:59 pkdesk 51909 48450 1.716667E-07 Jan 1 00:34:59 pkdesk 51909 48750 1.750000E-07 Jan 1 00:39:59 pkdesk 51909 49050 1.733333E-07 Jan 1 00:44:59 pkdesk 51909 49350 1.550000E-07 Jan 1 00:49:59 pkdesk 51909 49650 1.796667E-07 Jan 1 00:54:59 pkdesk 51909 49950 1.630000E-07 Jan 1 00:59:59 pkdesk 51909 50250 1.730000E-07 Jan 1 01:04:59 pkdesk 51909 50550 1.956667E-07 Jan 1 01:09:59 pkdesk 51909 50850 1.836667E-07 Jan 1 01:14:59 pkdesk 51909 51150 1.720000E-07 Jan 1 01:19:59 pkdesk 51909 51450 1.740000E-07 ############ Sample GPSMK4.DAT output 03-01 00:04:59 8.430000E-07 03-01 00:09:59 8.433333E-07 03-01 00:14:59 8.390000E-07 03-01 00:19:59 8.463333E-07 03-01 00:24:59 8.716667E-07 03-01 00:29:59 9.013333E-07 03-01 00:34:59 8.640000E-07 03-01 00:44:59 8.336667E-07 03-01 00:49:59 8.370000E-07 03-01 00:54:59 8.383333E-07 03-01 00:59:59 8.340000E-07 03-01 01:04:59 8.306667E-07 03-01 01:09:59 8.296667E-07 03-01 01:14:59 8.416667E-07