<div dir="ltr"><div>sort -n my_file | awk 'BEGIN{previous=""} $1 != previous { printf("\n%s
%s",$1,$2);previous=$1;next} $1 == previous {printf(" %s",$2)} END{print
""}'<br><br></div>where my_file has your records.<br><br>If the records are sorted already:<br><br>awk 'BEGIN{previous=""} $1 != previous { printf("\n%s %s",$1,$2);previous=$1;next} $1 == previous {printf(" %s",$2)} END{print ""}' my_file<br>
<br><br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 5 December 2013 22:38, Mick Farmer <span dir="ltr"><<a href="mailto:mick@plan7.co.uk" target="_blank">mick@plan7.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear GLLUGers,<br>
<br>
I have an input consisting of two fields such as<br>
<br>
...<br>
7 010c<br>
7 060b<br>
8 003d<br>
8 003g<br>
8 005n<br>
8 008c<br>
8 010a<br>
9 100c<br>
11 005m<br>
11 013a<br>
...<br>
<br>
which I want to merge on the first field (key) as follows<br>
<br>
...<br>
7 010c 060b<br>
8 003d 003g 005n 008c 010a<br>
9 100c<br>
11 005m 013m<br>
...<br>
<br>
I'm sure there's a UNIX utility that does this (sort?, uniq?) but can't<br>
currently find it. Can anyone help?<br>
<br>
Many thanks in advance.<br>
<br>
Regards,<br>
<br>
Mick<br>
<span class="HOEnZb"><font color="#888888">--<br>
Dr Mick Farmer<br>
<br>
Registered Linux User# 551012<br>
<br>
<br>
<br>
_______________________________________________<br>
GLLUG mailing list<br>
<a href="mailto:GLLUG@mailman.lug.org.uk">GLLUG@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/gllug" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/gllug</a><br>
</font></span></blockquote></div><br></div>