piping to "cut" and "sort", does the job as i wanted - thanks (just didn't know about the unique-switch in sort. Great!

 | cut -d "|" -f3 | sort -u"


Marco

Nikos Alexandris schrieb:
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.

begin:vcard
fn:Marco Lechner
n:Lechner;Marco
org;quoted-printable:Uni Freiburg;Institut f=C3=BCr Physische Geographie
adr:;;Werthmannstr. 4;Freiburg;;79085;Deutschland
email;internet:[EMAIL PROTECTED]
tel;work:+49 (0)761/203-3548
tel;fax:+49 (0)761/203-3596
x-mozilla-html:FALSE
version:2.1
end:vcard

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to