In your example input, all the clusters occur contiguously, i.e., all Osat_a members (just the one), then all the Atha_b members, all Fves_d members, etc. Is this the case in your real data, or might you have data like, e.g.,
where cluster members are promiscuously mingled?Osat_a Osat_a # just one cluster member Atha_b Atha_b # >1 cluster member, this & next line = 2 members Fves_d Fves_d # this & next 2 lines = 3 cluster members Osat_h Osat_h Atha_b Mtru_c Fves_d Osat_e Atha_g Atha_g # just 1 cluster member Fves_d Atha_f Osat_h Atha_i ... ...
If the former case (all cluster members contiguous) is true, processing of very large files is easy: just buffer all cluster members until you detect the transition from one cluster member to another, then write out all buffered cluster members. This could scale to millions of cluster members.
In the latter case, something like LanX's suggestion seems the way to go.
Give a man a fish: <%-{-{-{-<
In reply to Re: Processing while reading in input
by AnomalousMonk
in thread Processing while reading in input
by onlyIDleft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |