How to merge multiple rows into single row if first column matches ?

Hi,

Can anyone suggest quick way to get desired output?

Sample input file content:

A  12 9
A  -0.3 2.3
B  1.0 -4
C  34 1000
C  -111 900
C  99 0.09

Output required:

A 12 9 -0.3 2.3
B 1.0 -4
C 34 1000 -111 900 99 0.09

Thanks

How about this ?

sort Filename | awk '{if(a!=$1) {a=$1; printf "\n%s%s",$0,FS} else {a=$1;$1="";printf $0 }} END {printf "\n" }'
# awk '{a[x++]=$0;b[xx++]=substr($0,1,1)}END{for(i=0;i<x;i++)if(b==b[i+1]){f=f?f a[i+1]:f aa[i+1]}else{if(f=="")f=a;gsub(b" ","",f);
print b f;f=""}}' file
A 12 9 -0.3 2.3
B 1.0 -4
C 34 1000 -111 900 99 0.09

With a sorted input file:

awk '$1!=p{if(p)print s; p=$1; s=$0; next}{sub(p,x); s=s $0} END{print s}' infile

--
unsorted input file:

awk '{k=$1=$1; sub(k,x); A[k]=A[k] $0} END{for(i in A)print i A}' infile