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 --- * cut -d "|" splits an output line in more fields separated by the "|" character * -f3 (belongs to the cut command as well) and prints only the 3rd field * sort -u does the actual job. It prints only once a name/ number no matter how many times it appears. _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
