Leisner.Henr@XEROX.COM (Marty) (08/10/89)
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
arnold@mathcs.emory.edu (Arnold D. Robbins {EUCC}) (08/11/89)
In article <890810-084721-6771@Xerox> Leisner.Henr@XEROX.COM (Marty) writes: >RLENGTH -1 works differently than RLENGTH - 1. This is a gawk bug; in the former case gawk thought it had a concatenation. It should be fixed in 2.11. -- Arnold Robbins -- Emory University Computing Center | Laundry increases DOMAIN: arnold@unix.cc.emory.edu | exponentially in the UUCP: gatech!emoryu1!arnold PHONE: +1 404 727-7636 | number of children. BITNET: arnold@emoryu1 FAX: +1 404 727-2599 | -- Miriam Hartholz