This would seem to be an exact copy (result wise at least) of your previous post found
here
Not sure if you have read the LQ rules but double posting is frowned upon. Not only that but I already offered a solution ... did this not work?
Also, now that you have provided more information, does it have to be korn shell?
Also, why not just use your grep to get what you want.