[GRASS-user] generating a TXT file with "for..done" looping

Milton Cezar Ribeiro miltinho.astronauta at gmail.com
Wed Nov 12 17:53:34 EST 2008


Dear All,
I built the short code below and if I run if I run it under "bash" I can
generate a list of command that after I can copy and past, and
run under the same "bash" session. If I try remove the "echo"
I get errors. As the list of HEXID is so long (about 3.000)
I need to run the code below in parts, and do a lot of copy-and-past
to reach up the desidere result.

My question is if I can generate and text file to run all HEXIDs on one
session. I tryed change "echo.." by "cat ... >
c:/grass/scripts/myscript.txt"
but the file get some stranger simbols and I am not sure if
grass will understand it.

I run native wingrass 6.3.0, not under MSYS or linux.

Thanks for your time

Miltinho-Brazil

----

for HX in `v.db.select map=hex001000ha_clip column=HEXID
where="HEXID<=100"`; do
echo v.extract --o input=hex001000ha_clip output=vec_hex_temp where="\"`echo
HEXID=$HX`"\"
echo g.region vect=vec_hex_temp res=2.5
echo v.to.rast input=vec_hex_temp output=rast_hex_temp use=cat
echo r.mapcalc "\"rast_hex_temp_1=if(rast_hex_temp>0,1,null())"\"
echo r.mapcalc
"\"rast_hex_temp_1_uso=Floresta_Vale1Vale2_2pt5m_MATA_fundo3*rast_hex_temp_1"\"
echo r.stats -a input=rast_hex_temp_1_uso
output=D:/Usuarios/qtdhex1000_hexid`echo $HX`.txt
echo g.remove -f vect=vec_hex_temp
echo g.remove -f rast=rast_hex_temp,rast_hex_temp_1,rast_hex_temp_1_uso
echo g.region -d
echo #
done
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20081112/08ded0c8/attachment-0001.html


More information about the grass-user mailing list