v.report category advice revisited

Ronald Thomas ront at niwot.CFNR.ColoState.EDU
Wed Nov 24 10:46:31 EST 1993


This script will "fill-out" a dig_cats file for use by v.report; please
ignore the earlier "draft" copy I attached in my initial response.

****************begin "BOOST" *********************************

#!/bin/sh
#
# USAGE: "boost vect_file"
#This script fills in the spaces in a non-sequential category file
#to meet the strange requirements of the GRASS contributed program
# "v.report".  It affects the dig_cats file only, and leaves the 
# original dig_cats file behind as 'vect_file'.orig.
#created by:
# Ronald Thomas   ront at niwot.cfnr.colostate.edu                
# Natural Resource Spec. (GIS)   
# Resource Management Division  
# Rocky Mountain National Park 
# Estes Park, CO  80517       
#with assistance from GRASSuser list compatriots
if [ -z "$GISRC" ]
then
echo "You must be using GRASS to be using this program!!"
echo 
echo "                 exiting"
exit 1
fi
rm $LOCATION/dig_cats/$1.orig
cat $LOCATION/dig_cats/$1 > $LOCATION/dig_cats/$1.orig
head -4 $LOCATION/dig_cats/$1  >> $LOCATION/dig_cats/tempfile
last=`tail -1 $LOCATION/dig_cats/$1 | awk -F':' '{print $1}'`
i=0
until [ $i -gt $last ]
do
echo -n $i: >> $LOCATION/dig_cats/tempfile
egrep \^$i: $LOCATION/dig_cats/$1 | awk -F':' '{ORS = "";OFS = ":";print $2,$3,$4,$5}'  >> $LOCATION/dig_cats/tempfile
echo ""  >> $LOCATION/dig_cats/tempfile
i=`expr $i + 1`
done
mv $LOCATION/dig_cats/tempfile $LOCATION/dig_cats/$1


***************** end script file "boost" ****************


Ronald Thomas                                ront at meeker.cfnr.colostate.edu
 Natural Resource Spec. (GIS)         ^^^    Phone: 303-586-3565  x285
  Resources Management Division  ^^  ^^^^^   FAX: 303-586-4702
   Rocky Mountain National Park ^^^ ^^^^^^^  Estes Park, CO  80517



More information about the grass-user mailing list