in reply to Re: grep & timesearch
in thread grep & timesearch

Yes that would work it would just be like using perls grep function However I tried what you suggested and even put $key in the split function line of the timesearch script and it won't find what I search on and I know the script should find data because I verified the data to match. I even expanded my pattern match line so I could $key what field to look in and what it should be equal to but that didn't work either. For example here's what the lines of code I changed to try to make it work. Of course with $range equaling <STDIN>.
($min, $max, $key) = split /-/, $range;
if (($2 ge $min) && ($2 le $max) && ($3 eq $key)) { 
      push(@{$mylist{$2}}, $_); 
  }
I ALSO TRIED THE NEXT CODE
($min, $max, $key) = split /-/, $range;
if (($2 ge $min) && ($2 le $max) && /$key/) { 
      push(@{$mylist{$2}}, $_);
}
I ALSO TRIED THIS CODE BELOW TOO
$range = <STDIN>;
$key = <STDIN>;
($min, $max) = split /-/, $range;
if (($2 ge $min) && ($2 le $max) && grep /$key/, $_) { 
      push(@{$mylist{$2}}, $_);
}
Excuse my dumbness but I can't figure it out.

The brassmonk