[GRASS-user] d.polar strange behavior when using MASK
Glynn Clements
glynn at gclements.plus.com
Mon Oct 8 12:59:53 EDT 2007
Stefano Costa wrote:
> Il giorno ven, 05/10/2007 alle 15.26 +0100, Glynn Clements ha scritto:
> > Strange. How large is the 27616.0_raw file? Does anything get written
> > to the 27616.0_binned file? What happens if you execute the command
> > manually, i.e.:
>
> steko at cycnus:~/grassdata/donetta/steko/.tmp/cycnus$ ls -l
> totale 26340
> -rw-rw-rw- 1 steko steko 0 2007-10-05 21:12 15733.0
> -rw-rw-rw- 1 steko steko 0 2007-10-05 21:12 15733.1
> -rw-rw-rw- 1 steko steko 0 2007-10-05 21:13 15859.0
> -rw-r--r-- 1 steko steko 0 2007-10-05 21:13 15859.0_binned
> -rw-r--r-- 1 steko steko 6773154 2007-10-05 21:13 15859.0_raw
>
> and the result of the manual command is the same. However:
>
> cat ${TMP}_raw <-- runs fine (14 s on a 6MB file)
> cat ${TMP}_raw | grep -v '^*$' <-- very very slow (more than 1h
> on the same file)
I must be going blind; I missed that '*' the first time around. '^*$'
isn't (AFAICT) a valid regexp, as the '*' must be preceded by an
expression, and I don't think that '^' counts in this context.
I suspect that this is causing grep to get stuck in an infinite loop.
The * operator repeatedly matches the preceding expression until it
fails. But matching against ^ doesn't advance the pointer, so no
matter how many times it matches ^, it's still at the start of the
line.
If it's meant to eliminate lines which consist of nothing but an
asterisk, it should be:
grep -v '^\*$'
or:
grep -v '^[*]$'
to force the * to be treated literally.
Or maybe it's trying to match lines which consist of nothing but
spaces, but the space got "lost", in which case it should be:
grep -v '^ *$'
IIRC, some versions of grep treat operators (?, +, *, etc) as normal
characters if they aren't preceded by an expression, which would
explain why it works on some systems.
> However, this weekend there was an update to the Debian `grep' package
> and now d.polar is working.
>
> I'm not going to file a bug if no one else has this problem.
It should get fixed as soon as it's determined which pattern the grep
command is supposed to match.
If it isn't fixed within a day, please file a bug report.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list