[GRASS-dev] Get min and max value of the ranges reported by r.stats in case of fp input maps
Glynn Clements
glynn at gclements.plus.com
Tue Nov 20 10:09:28 PST 2012
Paulo van Breugel wrote:
> Is there a way to get the minimum and maximum values separately for each of
> the ranges reported by fp in case of fp input maps?
>
> I could use e.g., awk to separate the columns, but the problem is with
> negative values, like in the example below:
>
> -1--2 | 5
> -2-0 | 10
> 0-1 | 3
>
> The minus sign and the dash to separate the minimum and maximum value of
> the range are the same character so separating by separator is not that
> straightforwards (or maybe / hopefully I am missing something obvious).
A '-' is a minus sign if it occurs at the beginning of the string or
immediately following another '-', otherwise it's a dash.
The following regexp should match the above syntax correctly:
^\(-\?[0-9]\+\)-\(-\?[0-9]\+\) *| *\([0-9]\+\) # basic RE syntax
^(-?[0-9]+)-(-?[0-9]+) *\| *([0-9]+) # extended RE syntax
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list