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());
43 } elsif ($arg =~ /^\d+$/) {
50 die "usage: grepdbg [nn] [[-nnn] ..] <regexp>\n" unless $string;
52 push @list, "0" unless @list;
53 for my $entry (@list) {
54 my @now = Julian::sub(@today, $entry);
55 my $fh = $fp->open(@now);
62 shift @prev while @prev > $nolines;
63 if ($line =~ m{$string}io) {
65 my @line = split '\^';
67 print atime($t), ' ', join('^', @line), "\n";