[GRASS-user] d.polar strange behavior when using MASK

Glynn Clements glynn at gclements.plus.com
Mon Oct 8 18:26:45 EDT 2007


Stefano Costa wrote:

> > If it's meant to eliminate lines which consist of nothing but an
> > asterisk, it should be:
> > 
> >         grep -v '^\*$'
> 
> I tried this and it was slow just as its `wrong' counterpart '^*$'.
> In fact, I tried both the right and wrong regexps _without_ the -v flag
> to see which lines where matching: in both cases ('^*$' and '^\*$')  on
> my system all NULL cells (represented by *) were matching the regexp,
> and the grep was taking hours to complete.

Do you mean that it does actually complete, it's just very slow?

If you aren't sure whether it's actually processing data or stuck in
an infinite loop, "strace" will show whether it's actually reading the
file.

> My MASK actually leaves about
> 99% of the cells out.
> 
> Given the fact that the Debian package update took away the problem, I
> ended up thinking that it was grep badly behaving with the -v flag. But
> I have no clues about that.

All in all, this does sound like a bug in specific version of grep.

Even so, the regexp should still be changed; * is an operator, and
should be escaped if it is meant to be interpreted literally.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list