Hi.
Off the top of my head (but before more than one cup of coffee):
1) I agree with RudiC. The OP asked for
all sets.
2) I think I'd try applying the idea of a sieve as in
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
So I'd sort the list, and, starting from the top, record matches, and erase from the original the matched items. The move to the next. Perhaps hashes would be faster than going through the list a number of times, but I haven't thought about that in detail.
I'd save the sets in filenames like, for example, for the string
abc:
_bc,
a_b, and
ab_
The list is presumably from some work, perhaps a dictionary as mentioned by the OP, so it is not as large as a complete set of permutations could be (26 items taken 3 at a time, some 15K if I did that correctly). I tried a few initial stabs using a common list of words, 25143 items total, of which 800 were 3 characters long.
So perhaps an awk/perl code to start, but might need a compiled code if that's too slow.
3) I wish that the OP had given more information about
why this is needed.
Best wishes ... cheers, drl