Lookup value in file and Append new value at EOL

Hi All,

I am new to shell scripting but have successfully created some of my own scripts using awk and sed. However, I have come across a problem that I cannot solve on my own and have not been able to find a good example that relates to what I am trying to do.

What I need is for the kornshell to go line by line in a file and look at bytes 9-10.

If bytes 9-10 = "NY" for example, "NE* should be appended at the end of the line, bytes "20-22"
But if bytes "9-10" = "FL" then "SE*" should be appended at the end of the line, bytes "20-22"

Could anyone please help me with this?
I need this ASAP and just have not been able to find a good example

Thank you ver much in advance!

input file

> cat input1
12345678NY123456789
12345678NY123456789
12345678NY123456789
12345678NY123456789
12345678FL123456789
12345678FL123456789
12345678NY123456789
12345678NY123456789
12345678FL123456789

script

> cat append_region 
rm input2
while read zf
   do
   state=$(echo "$zf" | cut -c9-10)
   case $state
     in
        NY) region="NE*" ;;
        FL) region="SE*" ;;
   esac
   echo "$zf""$region" >>input2
done<input1

output file

> cat input2
12345678NY123456789NE*
12345678NY123456789NE*
12345678NY123456789NE*
12345678NY123456789NE*
12345678FL123456789SE*
12345678FL123456789SE*
12345678NY123456789NE*
12345678NY123456789NE*
12345678FL123456789SE*
awk '
substr($0,9,2)=="NY"{print $0 "NE*";next}
substr($0,9,2)=="FL"{print $0 "SE*";next}
{print}' file

If you get errors use nawk, gawk or /usr/xpg4/bin/awk on Solaris.

Regards

Thank you very much to you both.....I will give this a shot now and see how this goes

Please ignore this post I forgot to include done
Thanks for the help