Often this is due to pinching of a nerve
between 2 ribs(intercostal nerve).
The pain is sharp,fleeting and usually made worse or brought on by a deep breath or motion of the rib cage. It is not a serious problem and usually eventually clears on its own. A lung problem is less likely. See your Physician if symptoms persist.