mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Warner Losh](/assets/img/avatar_default.png)
Note: this backs out a number of changes we've made to awk because they aren't upstream, but are on the vendor branch. Those will be reapplied. svn makes it needlessly difficult to know which ones, but at least r315426, r301289, and maybe r301691, though there may be others too. None of these are critical, so bisecting through this point is safe for all but awk regression tests :).
18 lines
465 B
Awk
18 lines
465 B
Awk
# The bug here is that nawk should use the value of OFS that
|
|
# was current when $0 became invalid to rebuild the record.
|
|
|
|
BEGIN {
|
|
OFS = ":"
|
|
$0 = "a b c d e f g"
|
|
$3 = "3333"
|
|
# Conceptually, $0 should now be "a:b:3333:d:e:f:g"
|
|
|
|
# Change OFS after (conceptually) rebuilding the record
|
|
OFS = "<>"
|
|
|
|
# Unmodifed nawk prints "a<>b<>3333<>d<>e<>f<>g" because
|
|
# it delays rebuilding $0 until it's needed, and then it uses
|
|
# the current value of OFS. Oops.
|
|
print
|
|
}
|