Newsgroups: comp.unix.ultrix Path: utzoo!utgpu!watserv1!watcgl!idallen From: "Ian! D. Allen [CGL]" Subject: Ultrix 4.1 awk substr/split bug Message-ID: <1991Feb7.195823.14731@watcgl.waterloo.edu> Sender: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada Date: Thu, 7 Feb 1991 19:58:23 GMT Lines: 36 #!/bin/sh # This shows that substr and split interact in a bad way on Ultrix. # This appears in every version of Ultrix I have tried here, including # the very latest Ultrix 4.1 (RISC). # (Same bug shows up on several O/S, including 4.3 BSD.) # idallen@watcgl.waterloo.edu # exec awk ' BEGIN { s = "xxxxxxxxxarg1 arg2" print "substring is", substr(s,10,20) n = split(substr(s,10,20),x," ") print "n is", n print "x[1] is", x[1] print "x[2] is", x[2] t = substr(s,10,20) n = split(t,x," ") print "n is", n print "x[1] is", x[1] print "x[2] is", x[2] }'