I'm trying to compare the read out number with an int but I get an error message
: integer expression expected: [: 10
: integer expression expected: [: 69
: integer expression expected: [: 1
: integer expression expected: [: 23
: integer expression expected: [: 24
: integer expression expected: [: 69
: integer expression expected: [: 120
: integer expression expected: [: 96
: integer expression expected: [: 21
: integer expression expected: [: 21
The homerseklettest3.txt contains (in each row) an 'x' and 'y' coordinates, a date, a time, and a heat number. I need to write out what the highest heat number is and where is that ('x,y' coordinates).
I've tried removing the hidden characters that maybe there but then I got even more error messages.
#! /bin/bash
highestTemp=-10000
highestTempX=0
highestTempY=0
while read -r line
do
x=$(echo "$line" | cut -d "," -f 1)
y=$(echo "$line" | cut -d "," -f 2)
temp=$(echo "$line" | cut -d "," -f 5)
if [ "$temp" -gt $highestTemp ]
then
highestTemp=$temp
highestTempX=$x
highestTempY=$y
fi
done < homerseklettest3.txt
echo "Highest Temperature: $highestTemp"
echo "Coordinates: $highestTempX $highestTempY"
The output should be:
Highest Temperature: 120 Coordinates: 92.7418529 99.9999999
Here's the text file from which I read the data.
47.6498634,19.1404118,2003.3.22,19:20,10
23.1231234,69.9651548,2000.11.13,7:42,69
69.6969696,11.1111111,1985.8.25,1:1,1
11.2222222,22.3333333,6969.10.1,18:12,23
47.6498634,43.2312457,2120.2.30,14:14,24
92.7418529,99.9999999,1500.10.9,9:20,69
92.7418529,99.9999999,1760.5.10,5:20,120
23.1231234,69.9651548,2010.8.20,16:36,96
92.7418529,99.9999999,1761.5.10,5:20,21
92.7418529,99.9999999,1760.5.10,5:20,21