Is there a way to determine whether the current line is the last line of the input stream?
You've got two options, both kind of messy.
You might have to play with #2 a little to get it to run, but it should work. Its been a while since I've done any awk.