Request to check remove duplicates but write before it

Hi alll

I have a file with following kind input

I want in output duplicates should not be there but there should be numbering mentioned before that like

awk -F. '{a[$2]=a[$2]" "$1}END{for(i in a)print i"."a}' infile

Hi

Thanks for reply. I am not getting result using followin commnad is there any error?

actually the inputdata is not as numbered 1,2

it's like this:input is actually a long list like this

so I wan output shuld contain

common entries shuld be mentioned in front of those .and duplicates shuld be removed.


$awk 'BEGIN{i=0}{if(!a[$2]){b[i++]=$2;a[$2]=$2" "$1}else{a[$2]=a[$2]","$1}}END{for (j=0;j<i;j++){print a[b[j]]}}'  inputfile

That's about the same question as in your other thread.
http://www.unix.com/shell-programming-scripting/194095-request-check-find-common-write-before.html\#post302673689

Please refrain from double posts which I consider your 2 posts having the same type of question.