[GRASS-user] occurrence of attributes in vektortable

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Fri Mar 7 07:26:05 EST 2008


On Fri, 2008-03-07 at 13:12 +0100, Nikos Alexandris wrote:
> On Fri, 2008-03-07 at 11:37 +0100, Marco Lechner wrote:
> > hi list,
> > 
> > how can i get a list of all different occurences in a column of an 
> > attributetable.
> 
> Marco,
> 
> in a linux-box another way would be to combine db.select with the "sort"
> command.
> 
> Example (commands in quotes):
> 
> I have a table TrainingSamples which looks like:
> 
> "v.info -c TrainingSamples"
> Displaying column types/names for database connection of layer 1:
> INTEGER|cat
> INTEGER|clccode_le
> TEXT|label
> 
> 
> "db.selct TrainingSamples"
> 1|3|vegetation
> 2|334|Burned
> 3|334|Burned
> 
> [...]
> 
> 45|332|non_veg
> 46|2|agro
> 
> And I want to get only the number of different  labels (in column
> "label")
> 
> "db.select TrainingSamples | cut -d "|" -f3 | sort -u"
> agro
> Burned
> label
> minext
> non_veg
> non_vegetation
> urban
> vegetation
> water

To kick-out the "label" from being printed... (!)

db.select TrainingSamples | cut -d "|" -f3 | sort -u | grep -v label



More information about the grass-user mailing list