From: William James Date: 2008-01-23T16:30:01+09:00 Subject: Re: How to improve this code? On Jan 22, 7:05 pm, Jair Rillo Junior wrote: > Hi guys, > I am new in the Ruby world, I am coming from Java, and I would like to > "think " in Ruby instead Java. > > I did a code to read a CSV file (separated by comma), organize the > values and print the output. > > Basically the CSV looks like this: > b...@bla.com,value1 > b...@bla.com,value2 > b...@bla.com,value3 > b...@bla.com,value4 > r...@ruby.br,value1 > r...@ruby.br,value2 > > the output should be in two lines > b...@bla.com,value1,value2,value3,value4 > r...@ruby.br,value1,value awk -F, "{a[$1]=a[$1] FS $2} END{for(k in a)print k a[k]}" file