[news.software.b] C news newgroup - awk failure

ssb@quest.UUCP (Scott S. Bertilson) (10/31/90)

  I've had problems lately with "gnu.g++.bug" being inserted into my
active file every time a bogus "newgroup" comes across the net.
I had about 4 copies earlier today (in addition to the real one).
  It seems that "awk" and "nawk" aren't able to match the pattern:
	"^gnu\.g++\.bug "
against the newsgroup name.  I've found that it works if I change the
pattern to:
	"^gnu\.g\++\.bug "
or
	"^gnu\.g.+\.bug "
  I've tried this on SCO ODT, Altos UNIX SVR3.1, and a 3B1
running SVR1 (3.51).  I've changed my copy of "newgroup" to use
"sed" instead.  Here's my test line:
	echo 'gnu.g++.bug 00001 00001 y' | awk '/^gnu\.g++\.bug / {print}'
-- 

Scott S. Bertilson   ...ssb@quest.UUCP
			scott@poincare.geom.umn.edu

ssb@quest.UUCP (Scott S. Bertilson) (10/31/90)

  Correction, I'm still using awk:
	pat="$1"
	type=`awk "\\$1 == \"$pat\" { print \\$4; exit }" $NEWSCTL/active`
-- 

Scott S. Bertilson   ...ssb@quest.UUCP
			scott@poincare.geom.umn.edu

henry@zoo.toronto.edu (Henry Spencer) (11/01/90)

In article <10885@quest.UUCP> ssb@quest.UUCP (Scott S. Bertilson) writes:
>  I've had problems lately with "gnu.g++.bug" being inserted into my
>active file every time a bogus "newgroup" comes across the net.
>I had about 4 copies earlier today (in addition to the real one).
>  It seems that "awk" and "nawk" aren't able to match the pattern:
>	"^gnu\.g++\.bug "
>against the newsgroup name...

The underlying problem is that `+' is a magic character in awk regular
expressions, just like `.', and the group-matching stuff isn't allowing
for this.  This will be fixed at some point.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry@zoo.toronto.edu   utzoo!henry