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

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

gawk match bug


From: Drabløs Finn
Subject: gawk match bug
Date: Tue, 8 May 2001 08:50:08 +0200

Please excuse me if this is a well known bug, but I have
some problems with the gawk match command. If I run the
following script with gawk 3.0.6 as distributed with Red Hat
linux 7.0 the script hangs after the first call to match.
The same script runs without any problems if I use nawk
on an IRIX 6.5 system.

(Yes, I know that the patterns are weird :-)  However, it
is a real case from molecular biology / bioinformatics. This
is just a bug-reproducing fragment from a larger program ...)

---------------------------------------------------------------
#!/usr/bin/gawk -f
#
BEGIN {
   Str_1="CCCCCHHHHHHHHHHHHHHHHHHHHCCCCEEEEEEECCCCCCCCCCCC" \
         "HHHHHHHHHHHHHHHHHHHHHHHHHCCCCCCCCCCCC"
   Pat_1="[^H][^H][^H][^H][^H]HHHHHHHHHHHHHHHHH?H?H?H?H?H?" \
         "H?H?H?H?H?H?H?H?H?H?[^H][^H][^H][^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?HHHHHHHHHHHHHHHHH?H?" \
         "H?H?H?H?H?H?H?H?H?H?[^H][^H][^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?$"
   Pat_2="[^H][^H][^H][^H][^H]HHHHHHHHHHHHHHHHH?H?H?H?H?H?" \
         "H?H?H?H?H?H?H?H?H?H?[^H][^H][^H][^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?"
   Pat_3="[^H][^H][^H][^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?HHHHHHHHHHHHHHHHH?H?H?H?H?H?H?H?H?H?H?H?" \
         "[^H][^H][^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?[^H]?" \
         "[^H]?[^H]?[^H]?[^H]?[^H]?$"
         
   if (Str_1 ~ Pat_1) print "Pattern 1 OK"
   if (Str_1 ~ Pat_2) print "Pattern 2 OK"
   if (Str_1 ~ Pat_3) print "Pattern 3 OK"

   print match(Str_1,Pat_1);print RSTART, RLENGTH
   print match(Str_1,Pat_2);print RSTART, RLENGTH
   print match(Str_1,Pat_3);print RSTART, RLENGTH
}
---------------------------------------------------------------

Regards,
Finn Drablos
SINTEF Unimed MR Center  phone +47 73 59 05 31
N-7465 Trondheim         fax   +47 73 55 13 55
NORWAY                   http://www.sintef.no



reply via email to

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