Path: utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!XEROX.COM!Leisner.Henr From: Leisner.Henr@XEROX.COM (Marty) Newsgroups: gnu.utils.bug Subject: gawk bug? Message-ID: <890810-084721-6771@Xerox> Date: 10 Aug 89 15:47:08 GMT Distribution: gnu Organization: GNUs Not Usenet Lines: 37 I seem to have tripped over something. I have nothing to compare to (this won't run on old awk) and I haven't found anything in the documentation to cover this case. RLENGTH -1 works differently than RLENGTH - 1. Example: { match($0, "this is a bug") pattern = substr($0, RSTART, RLENGTH ) bad = substr($0, RSTART+1, RLENGTH -1) good = substr($0, RSTART+1, RLENGTH - 1) print "found pattern " pattern print "bad = " bad print "good = " good } Input='this is a bug, trying out awk' Output: gawk -f bug.awk bug.tst found pattern this is a bug bad = his is a bug, good = his is a bug Problem: the comma at the end of bad shouldn't (??) be there. What's the story on this? marty ARPA: leisner.henr@xerox.com GV: leisner.henr NS: leisner:wbst139:xerox UUCP: hplabs!arisia!leisner