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

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

Re: Bug with gawk regex interval processing


From: Aharon Robbins
Subject: Re: Bug with gawk regex interval processing
Date: Sun, 11 May 2003 16:01:34 +0300

Greetings. Re this:

> Date: Mon, 21 Apr 2003 10:26:07 -0500
> From: Mike Kistler <address@hidden>
> To: address@hidden
> Subject: Bug with gawk regex interval processing
>
> Hello,
>
> I think I have uncovered a bug in gawk regular expression interval
> processing.  Below is a script to reproduce the problem.
>
> #!/bin/bash
>
> # This script reproduces an apparent bug in regex processing in awk.
> # The problem is that interval expressions are not handled properly.
>
> # This problem occurs on RedHat 8.0.  awk is packages in gawk-3.1.1-4
>
> # The purpose of the awk script is to eliminate the first three 
> space-delimited fields from each
> # input record and print the remaining contents.
>
> cat > /tmp/awkbug.dat <<EOF
>   token1  token2   token3   token4
>   token1  token2   token3   token4  token5
>   token1  token2   token3   token4  token5 token6
>   token   token    token    token4
>   token   token    token    token4  token5 token6
> EOF
>
> # This awk script fails ... apparently because of the interval.
> awk --posix '{sub(/^[ ]*([^ ]+[ ]+){3}/, "", $0); print $0}' /tmp/awkbug.dat

I cut and pasted your example file and program into all of gawk 3.1.1, 3.1.2,
and my current development code. The result I got was:

$ gawk-3.1.1 --posix '{sub(/^[ ]*([^ ]+[ ]+){3}/, "", $0); print $0}' 
/tmp/awkbug.dat
token4
token4  token5
token4  token5 token6
token4
token4  token5 token6

The result was the same for all three.  I use LC_ALL="C" in my .profile.
Perhaps it's a weird locale issue?

Arnold Robbins




reply via email to

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