Bourne shell programming hint wanted

Could some help me with this little bourne shell programming problem that
I have. I would like to select all clumps that are smaller than a
certain size that I have specified in a separate file RM.SIZE. Different
categories have different size criteria. This script works but I would
like to make this script easier so that the file with the
RM.SIZE could be read only once in the gawk script. I would like to
avoid using the for loop. (The reason why I have used gawk instead of
awk is that awk can't handle arguments on my machine. I guess most sun users
and other machine users could use awk properly.)

Lars

Lars Schylberg Email: larss@fmi.kth.se
Department of Photogrammetry
Royal Institute of Technology Tel. +46 8 790 86 33
S-100 44 STOCKHOLM, SWEDEN Fax. +46 8 790 66 10

------
my script that I feel should be simplified:
$OUT.clump is a clump map made from $IN that contains
the original categories
------

r.stats -cqz input=$OUT.clump,$IN output=$OUT.STAT
for obj in `cat $OUT.STAT | awk '{print $1}'`
do
   category=`cat $OUT.STAT | gawk '{ if ( OBJ == $1 ) print $2 }' OBJ=$obj`
   cat $OUT.STAT | gawk '{ if ( $3 < SIZE && $1 == OBJ ) print $1 }' \
     OBJ=$obj \
     SIZE=`cat RM.SIZE | gawk '{ if ( CAT == $1 ) print $2 }' \
     CAT=$category'` >> RM.CLUMP.LIST
done
------
File: RM.SIZE if I have 5 original categoies
------
1 20
2 40
3 50
4 60
5 10
-------
File: $OUT.STAT ( the beginning could look like this )
-----------
1 3 443
2 2 485
3 3 754
4 3 393
5 3 2
6 3 764
7 1 10457
8 3 307
9 3 224
10 2 1
11 4 54
----------
File: RM.CLUMP.LIST could look like this after processing
----------
5
10
---------