#!/bin/ksh

# Modified February 4, 1998  rcg  Remove referecne to $datadir.

# squish - concatenate elements from each record and
# output as a single record.  Comments lines (as indicated by
# leading "#" are removed.  Input file is specified by p1
# and output is to standard out via echo command

#	$1 = input file name (should use full path name)

inputfile=$1
#echo " **DEBUG input file name = $inputfile \n"

if [ ! -r $inputfile ]; then
	echo "*** Error: Cannot read the input file "
	echo "$inputfile \n"
	exit 1
fi

let i=-1
cat $inputfile | while read record
do
set -A input $record
#echo " **DEBUG input= ${input[*]}"

let hash=`echo  ${input[*]} | grep -c "#" `
if [[ $hash -ge 1 ]]; then
	continue
fi
for x in ${record[*]}
	do
#	echo " **DEBUG, x = $x"
	let i=i+1
	outputrecord[i]=$x
#	echo " **DEBUG outputrecord[$i] = ${outputrecord[i]} \n"
	done
done
#echo " **DEBUG i = $i \n"
if [ i -ge 0 ]; then
	echo ${outputrecord[*]}
else
	echo " "
fi

exit 0
