I agree with LadyWolf; you must offer your cat another place in which to scratch.
Cats scratch for a couple different reasons: one is to shed the outer cuticle of the nail, one is to stretch their muscles and the other is to mark territory. That being said, it should be obvious that cats leave scent behind after scratching. They return to that spot which holds the scent to scratch more.
I do not condone any "swatting" or other physical punishment for cats. They will associate YOU with that negativity, and not neccessarily the behavior.
A squirt bottle, such as hannzach suggested could work (as long as they don't associate you with the water) but also make sure that the spot your cat has been scratching is unappealing. Putting double sided sticky tape on the spot(s) and then offering a scratching post right in front of the sofa will most often deter a cat from ripping your furniture to shreds.
A variety of places to scratch and also a variety of substrates on which to claw should do the trick. Be consistent, avoid punishment and reward your cat's good behavior with catnip on the new scratching post or rug.
You and your cat will be most pleased with the results!