Try something like this:
Code:
$ cat data
2007/02/19 00:00:06: Information: Switch SDT for out stream 510
2007/02/18 00:00:06: Information: Switch SDT for out stream 510
2007/02/19 01:00:00: Information: Switch SDT for out stream 510
2007/02/18 01:00:00: Information: Switch SDT for out stream 510
2007/02/19 01:59:00: Information: Switch SDT for out stream 510
2007/02/18 01:59:00: Information: Switch SDT for out stream 510
$
$
$ cat script
#! /usr/bin/ksh
timetosecs()
{
typeset time h m s
time=$1
time=${time%:}
h=${time%%:*}
time=${time#${h}:}
m=${time%:*}
s=${time#*:}
h=${h#0}
m=${m#0}
s=${s#0}
echo $((h*3600+m*60+s))
}
#clear
echo "Please enter word to search for : \c"
read searchstring
echo "Please enter outstream to search for : \c"
read outstream
echo "Switch or Build : \c"
read switchorread
echo "Please enter search date : (yyyy/mm/dd) \c"
read searchdate
echo "Please enter start time : (hh:mm:ss) \c"
read starttime
startsecs=$(timetosecs $starttime)
echo "Please enter end time : (hh:mm:ss) \c"
read endtime
endsecs=$(timetosecs $endtime)
exec < $outstream
while read date time rest ; do
[[ $date != $searchdate ]] && continue
secs=$(timetosecs $time)
((secs<startsecs)) && continue
((secs>endsecs)) && continue
echo $date $time $rest
done
$
$
$ ./script
Please enter word to search for : sjsjs
Please enter outstream to search for : data
Switch or Build : sjsjs
Please enter search date : (yyyy/mm/dd) 2007/02/19
Please enter start time : (hh:mm:ss) 01:00:00
Please enter end time : (hh:mm:ss) 02:00:00
2007/02/19 01:00:00: Information: Switch SDT for out stream 510
2007/02/19 01:59:00: Information: Switch SDT for out stream 510
$
The secret is converting time to seconds after midnight for easy comparing.