records in a line

Hi
I have a file "sample.txt"
--------------------
1
2
3
4
5
6
7

---------------------------

i want out like this
---------------------------
1,2,3,4,5,6,7
---------------------------

please provide script,

if you don't mind a trailing comma, you can do it in one line

tr "\n" "," < in > out

if not:

#!/bin/sh
touch out
LINECT=`cat in|wc -l`
COUNTER=1
while read line
do
  if [ ${COUNTER} -lt ${LINECT} ]
  then
     echo $line|tr "\n" "," >> out
  else
     echo $line >> out
  fi
  COUNTER=`expr $COUNTER + 1`
done < in
# tr "\n" "," < file
1,2,3,4,5,6,7,
# awk -F, '{a=a?a FS$0:$0}END{print a}'  file
1,2,3,4,5,6,7
cat urfile |xargs -n7
tr '\n' ',' < file|sed 's/.$//'

regards,
Sanjay

Hi

paste -s -d',' $file_name

awk 'ORS=","{print $0}' file

Thanks all of you.
but other script or not giving right output.

I am using this

cat urfile |xargs -n7 | tr " " ","