Hi Anonymous Monk,
I have had quite a thought about it and I think the thing I would most likely do is to first reduce complexity by removing all duplicated lines with the same integer infront of them. Is this right.
I tried running the script below and then ran the script above -jgg.pl. But the result are not good. Any ideas or suggestions how I could marry the two in a sensible fashion

Hi Anonymous Monk, I have had quite a thought about it and I think the thing I would most likely do is to first reduce complexity by removing all duplicated lines with the same integer infront of them. Is this right.

Based on your descriptions it sounds right.

I tried running the script below and then ran the script above -jgg.pl. But the result are not good.

What is wrong with the results?

Any ideas or suggestions how I could marry the two in a sensible fashion

I have edited the script above as follows (below): it writes out a temporary file that I will use while running my second script. The second script will now take the temporary file which I will delete afterwards.
Please critisize as it must be 100% accurate.