Luke Lonergan wrote: > 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.
Actually, mine returns ')' too for the last command. I didn't copy that into the email. How about the top tests? Notice I get an error on the first one without the backslash. Are you OK escaping '(' but not ')'? That might be a solution. > 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 > > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match