Concatenating contents of a file with members in a directory

Hi,

I have a unix file with the below structure -

CustId1   CustName1 CustPhn1  /u/home/xmldata/A000001
CustId2   CustName2 CustPhn2  /u/home/xmldata/A000002
CustId3   CustName3 CustPhn3  /u/home/xmldata/A000003

Then I have another unix directory /u/home/xmldata
This directory has below members which contain 1 XML record. Record length of XML is 80K.

A000001
A000002
A000003

My requirement is to concatenate 1st 3 fields of records in the file with the content of member name specified in 4th field.

For example, output should look like this -

CustId1   CustName1 CustPhn1  <XML record present in A000001>
CustId2   CustName2 CustPhn2  <XML record present in A000002>
CustId3   CustName3 CustPhn3  <XML record present in A000003>

Can somebody help me out with a shell script for this. I am completely novice to UNIX as I am a Mainframe guy.

Thanks in advance!!!

#!/bin/ksh

while read one two three four junk
do
   echo $one $two $three $(cat ${four})
done

Hi,

Thanks for your quick reply. I understand that the file we are reading will be parsed to 4 fields one two three & four. Then we are concatenating the one two three and contents of four.

Can you please help me out with the code of reading the input file and then writing the output to a output file.

Thanks again!!!

ooops - missed that :wink:

#!/bin/ksh  

while read one two three four junk
do    
    echo $one $two $three $(cat ${four})
done < myInputFile > myOutputFile