bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in GNU gawk - matching initial space in RE


From: Stepan Kasal
Subject: Re: Bug in GNU gawk - matching initial space in RE
Date: Wed, 17 Sep 2003 12:53:03 +0200
User-agent: Mutt/1.2.5.1i

Hello,

On Tue, Sep 16, 2003 at 01:28:56PM -0400, Barry Zeeberg wrote:
> gawk '{if($0 ~ /^ \<biological_process ;/)print $0}' gawk.bug.textfile
> 
> ==> gawk.bug.textfile <==
>  <biological_process ; GO:0008150

[...]

the problem is that you use \< instead of mere < .

You meant to use /^ <bio.../ (or /^ [<]bio.../ if you prefer it).

According to POSIX, awk regular expressions are derived from so called
"extended regular expressions", ERE's.  In ERE's, \< is in an ordinary
character, preceded by backslash, which yields undefined behaviour,
says POSIX.

Thus the behaviour is undefined by POSIX; some implementation may
consider \< to be the same as <, while GNU awk takes it as a word
boundary.

Hope this explains it,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]