Need Help in arranging the output

Hello All,

Please find attached input and output files. I want to write a shell script to achieve this. I tried using awk but not getting how to do this as I am new to shell programming.

Thanks

Try:

awk -vRS= '{a[$1]=a[$1](a[$1]?",":"")$2}END{for (i in a) print i","a}' file
1 Like

when I am running the command that you have given me, it is throwing some errors :-

awk: syntax error near line 1
awk: illegal statement near line 1

Use /usr/xpg4/bin/awk or nawk on Solaris.

As I specified in the output file attached, I need an output like this -

sudeep,kapil,ritesh
...

and I am getting the output like this -

,
kapil,
ritesh,
sudeep,

Please tell me how should I modify the command....and if you don't mind, please explain the command once as I am new to scripting.