Subject: Re: AWK vs. gawk.
To: None <netbsd-help@netbsd.org>
From: Jukka Salmi <jukka-netbsd@2004.salmi.ch>
List: netbsd-help
Date: 05/11/2004 15:39:38
Hi,

Richard Rauch --> netbsd-help (2004-05-11 05:30:50 -0500):
[...]
>   ret = gensub ("^[ ]*\\([ ]*", "", "g", ret );

I probably don't know what I'm talking about ;-), but shouldn't this
be written like this:

    ret = gensub (/^[ ]*\([ ]*/, "", "g", ret );

(i.e. /regex/ instead of "regex")


>   ret = gensub ("[ ]*\\)[ ]*$", "", "g", ret );
> 
> ...which should actually require the $ to be there.  (E.g.,
> consider:
> 
>     void func (void (*fptr) (void));

The regex won't match because of the semicolon.


> As near as I can tell, the NetBSD awk does not recognize
> ^ or $ in regular expressions.

It does, at least awk version 20030729:

$ awk -V
awk version 20030729
$ printf 'ae\ne\n' | awk '/^e/{print;}' 
e


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~