+08Nov02=======================================================================
+1. made some small mods to grepdbg and spot2csv.pl
07Nov02=======================================================================
1. allow three digit longitudes
2. make a small change to see if messages now stay in place.
# Program to do a grep with dates and times on the debug
# files
#
-# dispdbg [-nnn ...] <string>
+# grepdbg [nn] [-mm] <regular expression>
#
-# the -nnn is the day you what to look at -1 is yesterday -0 is today
+
+# nn - is the day you what to look at: 1 is yesterday, 0 is today
# and is optional if there is only one argument
-# <string> is the string, a caseless search is done
+#
+# -mmm - print the mmm lines before the match. So -10 will print
+# ten lines including the line matching the regular expression.
+#
+# <regexp> is the regular expression you are searching for,
+# a caseless search is done
#
#
#
# $Id$
#
-
# make sure that modules are searched in the order local then perl
-use DXUtil;
-
use strict;
+BEGIN {
+ # root of directory tree for this system
+ use vars qw($root $is_win);
+ $root = "/spider";
+ $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+
+ unshift @INC, "$root/perl"; # this IS the right way round!
+ unshift @INC, "$root/local";
+
+ $is_win = ($^O =~ /^MS/ || $^O =~ /^OS-2/) ? 1 : 0; # is it Windows?
+}
+
+use DXUtil;
+
die "usage: spot2csv.pl <filename> ....\n" unless @ARGV;
+my $crnl = $is_win ? "\015\012" : "\012";
+
for (@ARGV) {
unless (open IN, $_) {
print STDERR "cannot open $_ $!\n";
chomp;
s/([\%\"\'\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg;
my @spot = split '\^';
- my $date = cldate($spot[2]);
- my $time = ztime($spot[2], 1);
+ my $date = unpad cldate($spot[2]);
+ my $time = unpad ztime($spot[2], 1);
print "$spot[0]\t\"$spot[1]\"\t\"$date\"\t$time\t";
print $spot[3] ? "\"$spot[3]\"\t" : "\t";
- print "\"$spot[4]\"\t$spot[5]\t$spot[6]\t\"$spot[7]\"\r\n";
+ print "\"$spot[4]\"\t$spot[5]\t$spot[6]\t\"$spot[7]\"$crnl";
}
close IN;
}