Open the file and edit/append the text

Hi i have a file like this

mailboxnum 20
filename <to subsitute>
fileloaction /home/dd234/
filetype txt

in a directory i have set of files for ex:

TT45.1.2
TT45.1.3
TT45.1.4
.
.

in for loop i have to take this files and subsitute one by one

ex:

for i in `ls TT*`
do
<open the file>
<subsitute the filename value>
will some process based on the records in the file(executables pick the file and do some process)
done

Help me on this

---------- Post updated at 09:32 AM ---------- Previous update was at 09:10 AM ----------

i searched he thread but didn't find clues ...

That's a useless use of ls *. for file in `ls *` , when it works at all, has the same effect as for file in * .

for file in TT*
do
        exec 5<"$file" # Open the file
        read G MAILBOXNUM <&5
        read G FILENAME <&5
        read G FILELOCATION <&5
        read G FILETYPE <&5
        exec 5<&- # Close the file

        echo "Do something to ${FILELOCATION}/${FILENAME}.${FILETYPE}"
done