in reply to Mass file search prob

Well, if you want to search by time, but on a certain date, your going to have to ask for the time and date, then you could say.

for (@ARGV) { if ($_=~ m/(\w+)\.(\d+)\.(\d+)\.(\d+)$/) { if (($3>= $datemin) && ($3 <= $datemax) && ($4>= $timemin) && ($4 +<= $timemax)) { push(@{$mylist{$3}}, $_); } } }
my $name = 'Ben Kittrell'; $name=~s/^(.+)\s(.).+$/\L$1$2/g; my $nick = 'tha' . $name . 'sta';

Replies are listed 'Best First'.
Re: Re: Mass file search prob
by brassmon_k (Sexton) on Apr 04, 2001 at 21:21 UTC
    I knew I had to do something equivalant to doubling the output. My first idea was to put a $range2 in so I could get $range and $range2 so I could use $3 and $4 effectively doubling the script at the same time but that would produce the same results. Then I tried to cat the file with the datesearch results in it by piping to the timesearch script just to see if it would work but the 2 PERL scripts only read from the directory and can't read from a file oh just had an idea that I could've done I could've wrapped an AWK script to timesearch so it would read files but that would prob be more trouble than it's worth. I'm in the process of learning PERL so that one was tough for me.

    Thanks a lot Mr. Kittrell and Monks
Re: Re: Mass file search prob
by brassmon_k (Sexton) on Apr 10, 2001 at 01:13 UTC
    Your code will not work. You have to define datemin, datemax, timemin, timemax in the mylist portion also. Strict gives problems to. You have to put $datemin, $datemax, $timemin, $timemax into arrays.

    @date = ($datemin, $datemax)
    @time = ($timemin, $timemax)

    You also need to tell shift how to separate both date and time by dashes. Finally if you do all that (I'm a novice) I will not get any errors but when I do a search on (Didn't figure out how to tell split what to do and I'm guessing that's why I get the following errors).

    Use of uninitialized value in numeric ge (<=) at line blah
    Use of uninitialized value in numeric le (>=) at line blah

    I'm thinking either I'm not telling the script what to do with $4 or Since "split" is defined wrong for the search query the script can't initialize $3 or $4 for the search. So if you don't mind clarifying what you intended please do so.

    The Brass Monk