[GRASS5] viewing map attribute table
Hamish
hamish_nospam at yahoo.com
Mon May 30 01:40:39 EDT 2005
> Thinking about this a little more: it should be possible to select the
> contents of two columns into two arrays, do the calculation in the
> shell script and then update a third column with the resulting values.
> However, I am not sure if all shells support arrays ?
I think you will need to save to temp files. (use g.tempfile)
hints--
integer math in a shell:
expr 1 + 2
integer math in a bash shell:
echo $(( 1 + 2 ))
floating point math using "bc":
echo "scale=6; 1 / 2" | bc
But "bc" in not guaranteed to be installed on all systems.
floating point math using "awk":
echo "1 2" | awk '{print $1 / $2}'
then add column and populate with
echo "INSERT INTO $NAME VALUES ()" | db.execute
Hamish
More information about the grass-dev
mailing list