3 # Program to do a grep with dates and times on the debug
6 # dispdbg [-nnn ...] <string>
8 # the -nnn is the day you what to look at -1 is yesterday -0 is today
9 # and is optional if there is only one argument
10 # <string> is the string, a caseless search is done
16 # search local then perl directories
18 # root of directory tree for this system
20 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
22 unshift @INC, "$root/perl"; # this IS the right way round!
23 unshift @INC, "$root/local";
32 use vars qw(@list $fp @today $string);
34 $fp = DXLog::new('debug', 'dat', 'd');
35 @today = Julian::unixtoj(time());
46 die "usage: grepdbg [[-nnn] ..] <regexp>\n" unless $string;
48 push @list, "0" unless @list;
49 for my $entry (@list) {
50 my @now = Julian::sub(@today, $entry);
51 my $fh = $fp->open(@now);
57 if ($line =~ m{$string}io) {
58 my @line = split '\^', $line;
60 print atime($t), ' ', join('^', @line), "\n";