I need to extract log messages for a certain timeframe from a log file. following does not work. Please help
hour=`date +%H`
hour=`expr $hour - 1`
echo $hour
start1=$hour":00:00"
start="$start1"
end1=$hour":59:59"
end="$end1"
awk '$0 >= $start && $0 <= $end' server.log
But the following command works from the command line awk '$0 >= "11:00:00" && $0 <= "11:59:59"' server.log