I have a script which archives log file events which are 90-days old. Script works fine but I wanted some input on one aspect of this script. My nawk statement, bolded below, that removes events 90-days prior from today, I need it to find anything 90-days or older. The log file date pattern looks like this 03-29-2010
#!/bin/sh
LOG=tool.log
# Script will compress and archive tool log files older than 90-days
# Perl script to identify the date 90 days prior from today
date=`perl <<'EOF'
@T=localtime(time-86400 * 89);printf("%02d-%02d-%02d\n",$T[4]+1,$T[3],$T[5]+1900);
EOF`
# Next statement will add logs 90-days old in command_archive.gz file
nawk 'BEGIN {FS="\n"}{RS="#"}{ORS="#"}{if ($2 ~ /^'$date'/) print $0;}' $LOG > archive.temp
gzip -c archive.temp >> command_archive.gz
# Next statement will remove logs 90-days old from the tool.log file
nawk 'BEGIN {FS="\n"}{RS="#"}{ORS="#"}{if ($2 !~ /^'$date'/) print $0;}' $LOG > tmp_tool.log
cp tmp_tool.log $LOG