I'm trying to extract the xy coordinates of some earthquake occurrences along with their magnitudes from a file "seismic_c_am.txt", and plot them as circles of various sizes and colours based on the magnitude. Here is what I have so far:
25 i=`awk '{ FS = "|" ; print $11}' seismic_c_am.txt`
26
27 if [ "$i" -gt 7 ] ; then
28 awk 'NR%25==0 { FS = "|" ; print $4, $3}' seismic_c_am.txt | psxy $rgn $proj -Sc0.25c -Gred -O -K >> $psfile ;
29 fi
30
31 if [ "$i" -gt 5 ] && [ "$i" -le 7 ] ; then
32 awk 'NR%25==0 { FS = "|" ; print $4, $3}' seismic_c_am.txt | psxy $rgn $proj -Sc0.2c -Gorange -O -K >> $psfile ;
33 fi
34
35 if [ "$i" -le 5 ] ; then
36 awk 'NR%25==0 { FS = "|" ; print $4, $3}' seismic_c_am.txt | psxy $rgn $proj -Sc0.1c -Gyellow -O -K >> $psfile ;
37 fi
This script seems to just print all the magnitudes ($11) into the terminal, and the last line reads:
.
.
3.6
4.0
1.7
3.6 : integer expression expected
But I don't know which line this is referring to! Possibly line 27, 31 or 35? (see above)
5.5is not an integer, there's your problem. Same with the variables. You can't do floating-point maths in bash. Instead of calling awk so many times, you should try and combine the scripts together.