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

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

Re: Possibly a bug found


From: Dave B
Subject: Re: Possibly a bug found
Date: Sat, 12 Sep 2009 13:16:45 +0100
User-agent: KMail/1.9.10

On Saturday 12 September 2009, Igor Zhuravlov wrote:

> Following command fails to find two consequent newline chars:
>
> echo -e "aaa\n\nbbb" | gawk 'BEGIN {s="";} {s=s "\n" $0;} END {print
> match(s,"\n{2,}");}'
>
> Workaround:
>
> echo -e "aaa\n\nbbb" | gawk 'BEGIN {s="";} {s=s "\n" $0;} END {print
> match(s,"\n\n+");}'
>
> Software versions:
> - gawk: 3.1.7

GNU awk has traditionally required the --re-interval (or --posix) command line 
switch to have {}-style quantifiers work. However, a change in behavior was 
recntly announced to have {} recognized by default as mandated by POSIX. I 
seem to remember the change was announced for version 3.1.7, though I might 
be wrong, but apparently 3.1.7 still exhibits the old behavior (I tested it 
and you still need to use --re-interval). Maybe it's planned for the next 
release.

-- 
D.




reply via email to

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