Help required with formatting in scripting

Hi Friends,

I need to write a script which reads the file and prints them horizontally.

For example,

the file contains something like

x1
x2
x3
x4
x5

my script reads this file as "for i in `cat filename`", but I need an output something like

"config file = x1.ccfg, x2.cfg, x3.cfg, x4.cfg, x5.cfg"

How to do this ?

Thanks
Din

something like the following...

echo -n '"config file ='
for i in `cat filename`
do
        echo -n "$i.cfg, "
done
echo '"'

But the output looks like

% sh x.sh
-n "config file=
-n T1.cfg,
-n T2.cfg,
-n T3.cfg,
-n T4.cfg,
-n T5.cfg,
"

I want something like

% sh x.sh
"config file= T1.cfg,T2.cfg,T3.cfg,T4.cfg,T5.cfg"

i tried to do something like we used to do in normal programming languages " a = a + $i.cfg", but looks not working.

Where does T1, T2, etc. come from? Originally you had x1, x2, etc.

echo config file = $(xargs < filename -I{} echo {}.cfg)

config file = x1.cfg x2.cfg x3.cfg x4.cfg x5.cfg