Repairing household lamps that don't work properly is easily done. Available at any well-stocked hardware or electrical store, the plug and cord are simple and inexpensive to replace. Installing a light socket is just as easy. Replacement sockets come in various finishes so you should be able to find a socket that is similar to the color tone of the existing socket.
Lamp cord is known as Type SPT, or zip cord. The #18 size is satisfactory for most lamp applications. Zip cord is available in many colors, the most common being black, brown, white, and transparent. Match the cord color to the lamp stand or the wall that holds the receptacle. The customary length is 6 feet, but you can use as much cord as you need to reach from the lamp to the receptacle.
To figure out how much cord to buy, calculate the length of the cord (including cord that is hidden in the lamp), and add 1 foot for attachments to socket and plug and for slack. In terms of safety and appearance, it's better to have an adequate length of cord than to compensate for a short one with an extension cord.
Check out the next page for the first step.