Date Compare



I have a list like this............





5758M 65.3 427 Feb 9 23:00:00
5800M 64.3 424 Feb 9 23:15:00
5875M 94.1 426 Feb 9 23:30:00
5938M 95.1 427 Feb 9 23:45:00
5991M 46.2 436 Feb 10 00:00:00
6051M 55.8 429 Feb 10 00:15:00
6051M 72.2 429 Feb 10 00:30:00
6056M 82.0 423 Feb 10 00:45:00
7876M 63.3 416 Feb 11 22:45:00
7617M 53.9 420 Feb 11 23:00:00
7658M 42.5 415 Feb 11 23:15:00
7727M 79.8 419 Feb 11 23:30:00
7786M 88.6 419 Feb 11 23:45:00
7790M 49.1 430 Feb 12 00:00:00
7749M 36.0 421 Feb 12 00:15:00
7774M 56.8 418 Feb 12 00:30:00
7649M 58.3 414 Feb 12 00:45:00
............................
.....................
........................................



I have to extract only a limited date parameters with comparison to my
$1 and $2 ,

The script runs like this

../myscript "Feb-9" "Feb-11"

I can use "tr" to change the "Feb-9" to " Feb 9" ( without "-" )
or is there any way out to compare the dates I am pasting the
incomplete script in this message.
=============================================================
#!/bin/bash
# Get the name os source file as it is the third arguements.
usage() {
echo "$0: start-date: `date |cut -d" " -f2,3`
end-date: `date -d "+10 day"|cut -d" " -f 2,3` filename"
exit 0
}

if test $# -eq 3
then
START_DATE=`echo "$1"|tr "A-Z" "a-z"`
END_DATE=`echo "$2"|tr "A-Z" "a-z"`
SOURCE=`echo "$3"|tr "A-Z" "a-z"`
elif test $# -eq 2
then
START_DATE="$1"
END_DATE="$2"
SOURCE="all.stats"
else
usage
fi


# Convert the " " to "-" for later if-else comaprison.

_START_DATE=`echo "$START_DATE"|tr " " "-"`
_END_DATE=`echo "$END_DATE"|tr " " "-"`

# Set the name of destination file as it will contain the spanned
date's data.
_STATS_FILE="stats-$_START_DATE-$_END_DATE"

# the loop reads the data file and every input line is verified for
paramteres.
cat "$SOURCE" |while read line
do
THE_DATE=`echo $line|awk '{ print $4,$5 }'`
if test "$THE_DATE" >= "$START_DATE" -a "$THE_DATE" <= "$END_DATE"
then
do-something
fi


here is the actual comparison that I need to identify and clear, I want
that the START-DATE should be compared first and then END-DATE and if
soemthing matches , then it should extract that line.


Any Idea?


Regards,
Moody
PTML

.