I had a similar problem some years ago. My first attempt was to polish out the scratch with a commercial product that was basically a very mild polishing compound. Unfortunately, it only made the situation worse. I ended up with scruff marks all over the lens while the original scratch was too deep to be polished out anyway. Bad call, I ruined my slightly blemished but still perfectly usable sunglasses.

Later on I learned you can buy a repair kit that contains a transparent two-component resin of sorts. Sounded like a better solution to repair scratch marks, though still far from foolproof. If the scratches are deep enough to catch your fingernail there is probably little you can do about it.