----- Original Message -----
From: "Brian K. White"
Listmates,
I had to parse a file to find the max cputemp and I wanted to do it from the command line. There were several thousand lines of .25 sec cputemp data captured while mprime was running. The file format and the command line I came up with are:
input:
04:18 trinity~/linux/scripts> tail cputemp.log 20080419 02:32 65.0 C 20080419 02:32 65.0 C <snipped>
command line and output:
04:17 trinity~/linux/scripts> tmax=0; while read a b t c; do t=$(echo "$t" | sed -e 's/\.//'); if (( $t > $tmax )); then tmax="$t"; fi; done < ./cputemp.log ; tmax=$(echo "$tmax" | sed -e 's/\([0-9][0-9]\)\([0-9]\)/\1\.\2/'); echo "Max temp is: $tmax"
Max temp is: 69.5
MAXTEMP=0
while read DATE TIME TEMP SCALE ;do
[[ 1${TEMP/./} -gt 1${MAXTEMP/./} ]] && MAXTEMP=$TEMP
done