Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcupt1!hpindwa!khoa From: khoa@hpindwa.cup.hp.com (Khoa Ton) Newsgroups: comp.unix.shell Subject: nawk Bug? Message-ID: <63060001@hpindwa.cup.hp.com> Date: 14 May 91 05:43:39 GMT Organization: Hewlett-Packard, Cupertino CA Lines: 54 I found what seems to be a bug in nawk. The built-in function match (a, b) is supposed to find regular expression b in string a and return 1 if found else 0, according to the man page. Match () does not work. Any help or information would be greatly appreciated. Khoa Ton $ what $(which nawk) /usr/bin/nawk: $Revision: 64.13.1.1 $ Following are the bug.* files for the command: $ nawk -f bug.awk bug.in > bug.out :::::::::::::: bug.awk :::::::::::::: { hit= match ($0, "junk"); print $0; printf ("Hit:%d\tRSTART:%d\tRLENGTH:%d\n", hit, RSTART, RLENGTH); } :::::::::::::: bug.in :::::::::::::: line 1 line 2 line 3 line junk line 5 line 6 :::::::::::::: bug.out :::::::::::::: line 1 Hit:-166200 RSTART:-166200 RLENGTH:0 line 2 Hit:-166200 RSTART:-166200 RLENGTH:0 line 3 Hit:-166200 RSTART:-166200 RLENGTH:0 line junk Hit:1 RSTART:1 RLENGTH:4 line 5 Hit:1 RSTART:1 RLENGTH:4 line 6 Hit:1 RSTART:1 RLENGTH:4 ------------------------------------------------------------------------------- Khoa Ton khoa@hpindno.hp.cup.com Hewlett-Packard Co. Cupertino, CA (408)447-3362 -------------------------------------------------------------------------------