That's actually not what doctors say. When they can't determine if an infection is viral or bacterial, they treat it on the chance that it's bacterial (since we have a known treatment for bacterial infections and don't usually have a treatment for viral infections).
Tonsillitis is a good example: About 50% of tonsillitis cases are viral and 50% bacterial. "Relying on clinical presentation and history alone is unreliable in differentiating streptococcal from viral tonsillitis."[1] And bacterial tonsillitis can be quite serious.
So it seems reasonable to go ahead and treat with antibiotics even when there's a 50% chance that it's wasted, because the other 50% chance was that the treatment was highly beneficial.
A fact pulled directly from your ass. Doctors never prescribe antibiotics for viral infections; antibiotics are for bacterial infections and no they don't just hand them out willy nilly.
Please don't be rude on Hacker News. This comment would be much better without the first sentence.