[GRASS-user] List of existing values

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Thu Jul 22 03:41:28 EDT 2010


Martin Landa wrote:
> > > as mentioned in Hamish's response, use combination of
> > > `sort` and `uniq`
> > > r.starts -1 input=data | sort | uniq

Nikos:
> > shorter:
> > r.starts -1 input=data | sort -u

Hamish wrote: 
> AFAIR, those are not the same thing and can not be used
> interchangeably. (although I don't fully remember why right now)

It has troubled me as well (now and in the past). I did (before posting the 
above) a quick test using a column from a vector map containing strings. I 
counted the result from both "uniq" and "sort -u" with "| wc -l". The results 
were identical.

So... :-? Maybe it is ok for strings/integers(?). One should be more careful 
with those "knifes".
 
Nikos

> anyway, for floating point maps I still think it's a bad idea.
> 
> I'm sure there is a Python equivalent of 'sort|uniq', but don't
> know what it is. 
> 
> 'sort' and 'uniq' are UNIX command line power tools and not
> available in MS Windows. But.. the MSys command prompt that
> ships with WinGrass supplies them and you can use them there.
> I suppose the "bin" dir where they are kept are not part of the
> gui's PATH which is why they wouldn't work from the Cmd> gui
> prompt.


More information about the grass-user mailing list