[GRASS-dev] Re: [GRASS GIS] #1109: g.mlist functionality extension: return e.g. $prefix.001 to $prefix.031 out of $prefix.365 maps

GRASS GIS trac at osgeo.org
Mon Jul 19 03:41:48 EDT 2010


#1109: g.mlist functionality extension: return e.g. $prefix.001 to $prefix.031 out
of $prefix.365 maps
-------------------------------+--------------------------------------------
 Reporter:  nikos              |       Owner:  grass-dev@…              
     Type:  enhancement        |      Status:  new                      
 Priority:  minor              |   Milestone:                           
Component:  default            |     Version:  unspecified              
 Keywords:  g.mlist, pattern,  |    Platform:  Unspecified              
      Cpu:  Unspecified        |  
-------------------------------+--------------------------------------------

Comment(by hamish):

 try adding `seq` into your script. It's a really handy little command.

 {{{
 MAPS=""
 for i in `seq 32 59` ; do
   i_str=`echo $i | awk '{printf("%03d", $1)}'`
   if [ -n "$MAPS" ] ; then
      MAPS="$MAPS,radmap.$i_str"
   else
      MAPS="radmap.$i_str"
   fi
 done
 }}}

 you can add another loop around that with expr and "31 28 31..." to
 automatically set the $BEGIN and $END values for seq.


 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1109#comment:1>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list