cat.c library routine

Darrell McCauley mccauley at ecn.purdue.edu
Fri Oct 16 15:44:22 EDT 1992



[followups to grassp]

> Is there a way to modify the fprint  function of src/libes/gis/cat.c so that
> it will print out a dig_cats file in this longer format?  Our is there a 
> simpler UNIX routine to do the same that I'm missing?

Assuming the v.db.rim output format is valid, I would suggest recoding 
v.report instead. Alternatively, a quick fix would be a simple shell
script to do something like:

<2:37pm> ~# head -4 test.cat
<2:37pm> ~# set last=`tail -1 test.cat | awk -F':' '{print $1}'`
<2:38pm> ~# set i=0
<2:38pm> ~# while ($i <= $last)
while? echo -n ${i}:
while? egrep ^${i}: test.cat
while? end

redirect everything into a new cat file :-)

--Darrell McCauley

Original message:
> I am using the SCS's v.report program, and it needs a complete category file;
> meaning if your highest category is 146, you need to have 146 lines in the 
> dig_cats file, even if you have no category label for the attribute number.
> 
> Example, this dig_cats file;
> 
> # 421 categories
> Created by v.db.rim
> 
> 0.00 0.00 0.00 0.00
> 421:Lake or Pond
>   
> 
> has to be written as; 
> 
> # 421 categories
> Created by v.db.rim
> 
> 0.00 0.00 0.00 0.00
> 0:
> 1:
> 2:
> 3:
> 4:
> 5:
> 6:
>    etc
>   etc
>    etc
> 419:
> 420:
> 421:Lake or Pond
> 
> Is there a way to modify the fprint  function of src/libes/gis/cat.c so that
> it will print out a dig_cats file in this longer format?  Our is there a 
> simpler UNIX routine to do the same that I'm missing?
> 
> Thanx for any help!
> 
> ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^
>    Ronald Thomas                         ^  ront at meeker.cfnr.colostate.edu
>     Natural Resource Spec. (GIS)         ^  
>      Resource Management Division        ^   Phone: 303-586-3565  x285
>       Rocky Mountain National Park       ^          700-323-7285  (FTS)
>        Estes Park, CO  80517             ^ 
> ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^
> 



More information about the grass-dev mailing list