1b5253557SWarner Losh# The bug here is that nawk should use the value of OFS that 2b5253557SWarner Losh# was current when $0 became invalid to rebuild the record. 3b5253557SWarner Losh 4b5253557SWarner LoshBEGIN { 5b5253557SWarner Losh OFS = ":" 6b5253557SWarner Losh $0 = "a b c d e f g" 7b5253557SWarner Losh $3 = "3333" 8b5253557SWarner Losh # Conceptually, $0 should now be "a:b:3333:d:e:f:g" 9b5253557SWarner Losh 10b5253557SWarner Losh # Change OFS after (conceptually) rebuilding the record 11b5253557SWarner Losh OFS = "<>" 12b5253557SWarner Losh 13*17853db4SWarner Losh # Unmodified nawk prints "a<>b<>3333<>d<>e<>f<>g" because 14b5253557SWarner Losh # it delays rebuilding $0 until it's needed, and then it uses 15b5253557SWarner Losh # the current value of OFS. Oops. 16b5253557SWarner Losh print 17b5253557SWarner Losh} 18