That's a good idea since the key fields are spread out in the original data. Bringing them together really simplifies things.
There's another possibility if we're allowed to assume that the same key fields appear in the same order in each group, and each group is separated by a blank line (which is the case in the given data).
Code:
char table[MAX_ROWS][MAX_LINE]
row = 0
loop:
read a line
if the line is blank
break
else
strcpy(table[row++], line)
row = 0
loop:
read a line
if EOF
break
else if line is blank
row = 0
continue
else
strcat(table[row], "\t")
strcat(table[row++], second field of line)
print out the table
You could add a check to ensure that (for all groups after the first) the first field of the input line matched the first field in the current table element (fatal error, otherwise).
That's probably the simplest solution, but only because it makes the most assumptions.