Hello,

With this input (already sorted) :

KEY1_A_1
KEY1_A_2
KEY1_B_3
KEY1_B_4
KEY1_B_5
KEY2_C_6
KEY2_C_7
KEY2_D_8
KEY3_E_9

I'd like to get the following output :

KEY1_A_1
KEY1_A_2
KEY2_C_6
KEY2_C_7
KEY3_E_9

I.e. : For each KEY, I want to get all the lines ("all" will sometimes be only "one") that share the same "first-sub-key".

I thought the "unique" stage might do it, but I didn't find what I wanted. A kinf of "unique firsts" option.

Before I torture "unique", "spec" and the others and use multiple streams to build something ugly, is there any obvious idea I'm missing to do that ? (Performance is not an issue.)

Bonus question :
Is there an easy way to, then, get the following output ("joincont" wants a delimited string, but I don't have one) :

KEY1_A_1,2
KEY2_C_6,7
KEY3_E_9

Thanks,
Michaël

Reply via email to