Sorting the results gives the entire list, so if you have 1000 lines you have to go through all of them. In this example after applying the formula, there are 32 distinct patterns, I just want to list the pattern and its frequency only once, e.g.:
0000000 32
1000000 20
and so on. Sorting will list'000000' 32 times then '100000' 20 times, then the next, etc.
Thanks