First you need to run clstr2txt
(it comes with cd-hit). E.g.:
clstr2txt.pl BindingDBTargetSequences_100.fa.clstr > BindingDBTargetSequences_100_clusters.txt
Then, run the python code below, but change the variables (input and output file names):