Bruce,
> I found that parentheses in gawk regular expressions require backslashes
> so they are not treated as regex groupings:
> 
> $ echo '('|awk '$0 ~ /(/ {print $0}'
> awk: cmd. line:1: fatal: Unmatched ( or \(: /(/
> $ echo '('|awk '$0 ~ /\(/ {print $0}'
> (

 
> Now, it seems closing parentheses are OK because there is no open group,
> but I think I should use backslashes there too:
> 
> $ echo ')'|awk '$0 ~ /)/ {print $0}'
> )
> $ echo ')'|awk '$0 ~ /\)/ {print $0}'
> 
> Does your awk produce different results?  What version is it?  Mine is GNU Awk
> 3.0.6.

Yes - on the last test, mine emits the ")" and yours apparently does not.
The version I ran with is 3.1.4.

The escaped parenthesis in the unpatched pgindent causes the following
warning:

 $ pgindent test.c
 Hope you installed /src/tools/pgindent/indent.bsd.patch.
 awk: cmd. line:12: warning: escape sequence `\)' treated as plain `)'
 
Which implies an unnecessary escaping, which appears to function correctly
without the escape.

Cheers,

- Luke



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to