I am running Solaris and my log file starts like this:
TID: [0] [AS] [2018-10-03 10:36:57,958] DEBUG...
I am looking to output only the last five minutes of the log file. I have tried SED/AWK/GREP but I think I have the wrong regex format.
EDIT: Code already used
d1=$(date --date="-10 min" "+%b %_d %H:%M") d2=$(date "+%b %_d %H:%M") while read line; do [[ $line > $d1 && $line < $d2 || $line =~ $d2 ]] && echo $line done
awk -vDate="date -d'TZ="UTC" now-10 minutes' +'%Y-%m-%d %H:%M:%S.%3N'" '$1" "$2 > Date {print Date, $0}'
sed -n "/^$(date --date='10 minutes ago' '+%b %_d %H:%M')/,\$p" <log file location here>