The way to do it would be to do a continuity test using a multi meter from the good end and put that wire in corresponding pin of the terminal. Here's a link to pin numbers.
http://www.lammertbies.nl/comm/cable/HDMI.html
Be warned though if you get it wrong you could damage your tv and or any other connected device.
My advice would be if your not sure replace the cable even if it's a pain. It could be cheaper in the long run