In reply to Richard Carter:
Pull off the cable cap (ferrule) with a pair of pliers, needle nose if you have them. You can sometimes reuse them if they are not too mangled, but if not can be purchased cheaply from ebay or (free?) for your LBS. Crimp the new one on with pliers or cable cutter.
Cable are fine to reuse. Give them a wipe and degrease if dirty, I usually run a bit of lube along new cables, but apparently with plastic lined cables you don't even/not recommended to do this.
As always, Sheldon has the answers:
http://sheldonbrown.com/cables.html