The code that I tried to come up with is an embarasssment to the world.

An example of the original file would be:
I used to be stupid
I am still stupid
I will always be stupid

The second file (to be created) would be something like:
I used to be stupid,10
I am still stupid,10
I will always be stupid,10