[GRASSLIST:7145] Re: i.group output suitable for further processing?

Hamish hamish_nospam at yahoo.com
Mon Jun 13 18:00:05 EDT 2005


> I'm trying to write some scripts that will process all raster files that
> are referenced in a group. What I want to do is simple 'for $IMAGE in
> `i.group -l group=<group>`' bash scripting. However, the output of
> i.group -l is not suitable for this kind of thing: too much bloat. What
> I would like to have is only the raster names, and nothing more. Anyone
> knows a simple solution? O should I try to hack i.group and add a -b
> switch to generate output suitable for batch processing?


The group files are stored in a simple ascii file located in 
 $MAPSET/group/$GROUPNAME/REF

Then just cat and take the first column.


or automatically:

GROUP=groupname

REF_FILE="`g.findfile element=group file=$GROUP | grep '^file=' | cut -f2 -d"'"`/REF"

cat $REF_FILE | awk '{print $1}'



Hamish




More information about the grass-user mailing list