to replace Date format issue

Hi,
I have the below data in a file in one of the path,

101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
5200xxxxxxxxxx                          D18000_1  CCDXXXXXXX   JUL 31201207   1140689340000001
622113010547999999999003     000333333334RE  00030137 onee SYSTEM             0140689340000001
62200000 0000999999999001    0000011111CR460 00030135 twoo system             0140689340000002
82000000040015507087000000000000000003571110D18000_1                           140689340000001

Can some one tell me how to read the date from this file which is there in line 1 which is starting with indicator 1 at position 24 to 29
in this example it is 120731
which is in YYMMDD format
I want to replace from 70 to 75 with above date + 2 as 120802 in 2nd line which starts with indicator 5
My output should look like

101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
5200xxxxxxxxxx                          D18000_1  CCDXXXXXXX   JUL 31120802   1140689340000001
622113010547999999999003     000333333334RE  00030137 onee SYSTEM             0140689340000001
62200000 0000999999999001    0000011111CR460 00030135 twoo system             0140689340000002
82000000040015507087000000000000000003571110D18000_1                           140689340000001

Can some one please tell me how to do this?
Appreciate your response.

If you have gnu date this should do it:

dt=
ln=1
while read line
do
   [ $ln -eq 1 ] && dt=$(date -d "$(echo "$line" | cut -c24-29) + 2 day" +%y%m%d)
   [ $ln -eq 2 ] && line=$(echo "$line" | cut -c1-69)$dt$(echo "$line" | cut -c76-)
   ((ln++))
   echo "$line"
done < infile > outfile