Parodied in a Geico ad series which compares switching to Geico to various stock phrases asked as rhetorical questions. In this particular sketch, "Is the pen mightier than the sword?", a ninja brandishes his sword. The camera changes to a guy signing for a package with a pen. He opens the package and removes a taser, which takes the ninja out instantly.
One character in the Call of Duty: Black Ops 2 "Surprise!" ad fires off some missiles from his fighter plane, then quips: "Guess who brought a jet to a gunfight?" Bonus points: that's Robert Downey, Jr..
In Black Lagoon, Hansel comes after Balalaika alone in a wide-open plaza, armed only with a pair of axes. Balalaika is likely carrying a concealed pistol, but deals with the crazy kid to lethal effect by means of the sniper team she's set up some distance away.
During the "Fifth Moon" episode of the Trigun anime, Rai-Dei the Blade pits his katana against Vash the Stampede's guns. He turns the tables by first launching the blade off its hilt, then by fitting the hilt back onto the empty scabbard and using the whole thing as a rifle.
In Mobile Fighter G Gundam, Gentle Chapman, the pilot of the John Bull Gundam, ended up winning three Gundam Fights with his British Gundam, because he ended up shooting Gundams in the head, putting them out of the Gundam Fight. If it wasn't for Master Asia kicking his ass in the 12th Gundam Fight, things would have turned nasty.
It initially appears as "Overstreet's First Law of Tactics", from contributor Kris "Redneck" Overstreet's story The Quagmire Project:
Take a stick to a fistfight. Take a knife to a stickfight. Take a gun to a knifefight. Stay out of a gunfight.
Again, in Symphony of the Sword:
Percy "Techie" Mui: (to his son) To paraphrase Admiral Overstreet, bring a knife to a fistfight, a gun to a knife fight, grenades to a gunfight — oh, hell, if you know where it's going to be beforehand, mine the area. If all else fails, there's your friend, the air strike.
Then, "Gryphon's Expansion of Overstreet's Law of Tactics":
Take a stick to a fistfight. Take a knife to a stickfight. Take a gun to a knifefight. Take a 'Mech to a gunfight. Bring a lance to a 'Mech fight.
Followed by "Matrix Dragon's Expansion of Gryphon's Expansion":
If all else fails, bomb the planet.
And finally, "Julzz' Commentary":
And if all else fails, bring your friendly neighbourhood God.
Inverted, yes inverted in White Devil of the Moon. Hayate's forte is leveling city districts. Not so handy in one-on-one in close quarters combat. That was why Beryl quickly subdued her and stole the Jewel Seeds to revive Metallia. This is actually canon, as Hayate points out that Caro, a C-rank mage who's the weakest of the forwards in close combat, could potentially defeat her in single combat.
In The Prayer Warriors, Annabeth and her opponent in the coliseum fight with clubs until the opponent kills her with a knife. Suddenly, the main character's wife, Mary, shows up and shoots the opponent dead with a gun before proceeding to do the same with JohnLennon.
In Housemates, during Brother's Keeper, a guard tells this to Loki—right before being stabbed in the neck.
Guard: You know what they say about bringing a knife to a gun fight—
Loki: (Yanking the knife out of his neck No, I don't. You'll have to tell me sometime.
Once Upon a Time in China has this with kung-fu and rifles. Master 'Iron Robe' Yim is gunned down by American troops during his pursue of Wong Fey Hung. His last words are to Wong, who rushes to his aid: "Kung fu cannot beat bullets."
El Dorado. A young James Caan plays a character named Mississippi who, in search of vengeance for his old mentor, has killed two men by throwing a knife before they can draw their guns and succeeds in killing the last man involved by doing the same before cutting out his heart. Of course John had to save his life an instant later when the trope is played straight as the friend of the murderer is now aware of the knife and preemptively draws his gun.
The Untouchables, as noted in the page quote. Partly a subversion, since the knife guy was just there to lure the shotgun-carrying Malone into Frank Nitti's tommy-gun ambush. Earlier, Jimmy Malone tells Eliot Ness: "If he pulls a knife, you pull a gun."
In the Disney adaptation of Three Musketeers, the musketeers are charging a ship of sailors. When one of the sailors demonstrates his martial arts abilities to Oliver Platt, Platt mimics him briefly before simply shooting him in the chest.
In the The Three Musketeers (2011), D'Artagnan learns this early in the movie, courtesy of Rochefort. Although in this case, he brought a sword and lots of attitude to a gunfight.
Happens in Barb Wire when a thug tries to attack Barb with a knife, but she shoots him with her pistol.
In Hoffa, Danny DeVito pulls out a knife he uses for defense. Hoffa's goons pull out guns. After he joins with Hoffa's crew, one of Hoffa's cronies tells him, "Give me the knife. You wanna go around, go like a white man. Get a gun."
In Raiders of the Lost Ark, the famous scene where Indy shoots the swordsman. As the story goes, there was to be an extended sword fight, but Harrison Ford (playing Indy) was sick with dysentery, and suggested that he just shoot the swordsman. They decided to go with it.
Indiana Jones and the Temple of Doom has a Shout-Out to this scene in which Indy is confronted by two swordsmen. He reaches for his gun...only to find an empty holster, as he'd forgotten that his pistol was confiscated earlier in the movie.
"Nice try, kid, but I think you just brought a knife... to a gun fight."
Near the end of Thai martial arts movie Chocolate, a group of high ranking thugs grab katanas and rush at the Yakuza father of the protagonist. Crowning Moment of Funny ensues when he promptly shoots the first one down, though the rest close in and it turns into a sword fight.
As much as it is a love letter to the katana, Kill Bill follows this rule. Nearly any time the Bride's Katana is pitted against a gun, the gun wins, such as when the Bride charges into Budd's trailer, he is able to subdue her with a shotgun. And when she invades Bill's home, she's got a pistol out as her primary weapon rather than the sword slung on her back.
The final scene of The Warriors has Swan, knife in hand, facing down Luther and his gun. Weirdly enough, Luther shoots, but Swan dodges and nobody else gets harmed. Nobody else, that is, except for Luther, who takes a knife to his gun hand.
War Horse has a scene in World War One where the British cavalry appears to have caught the German encampment flatfooted, only to find that the Germans were prepared with a hidden defensive line of machine guns to mow them down. As a German officer says afterward, "Did you think we'd have a camp on open ground without it being defended?"
In the BBC adaptation of The History of Tom Jones, A Foundling (simply titled Tom Jones), when Lord Fellamar's attempted rape of Sophia is interrupted by her father, he turns his sword on the older man, assuring him that his class and education have well prepared him for anything the squire can dish out. Squire Western pulls out a pistol and promptly shoots out one of Fellamar's knees.
In Bodyguards and Assassins, the final assassin, a deadly Hero Killer martial artist, is killed by the Non-Action Guy with a pistol.
In We Were Soldiers a young North Vietnemese soldier charges from behind Colonel Hal Moore intending to kill him with a bayonet. At the last moment Moore turns around and shoots the North Vietnamese soldier with a pistol, who lands dead at his feet.
Subverted in the finale of Whos That Girl where the embezzling father of the protagonist's fiancée is actually able to disarm two cops using a fencing foil. (Yeah, it makes very little sense, but neither does most of the rest of the movie.)
In The Punisher (2004), the titular character's car is rammed at a railway crossing by an assassin sent by the Big Bad. He crawls out of it and brandishes a knife, only for the assassin to quote this trope and pull a gun. In a subversion, it turns out to be a ballistic knife, and the spring-launched blade hits the assassin in the throat. To be fair, though, he had no reason to expect such a weapon, as they're illegal in the US.
The Starship Troopers example above was also in the book... albeit very different. In boot camp, a raw recruit is complaining about learning how to use knives when the Mobile Infantry have awesome weapons and the Navy has nuclear weapons. The sergeant then... carefully and thoroughly explains the purpose. The Navy is a hammer, the MI are a scalpel, intended to be walking death with anything and everything, but very, very precise.
Played straight several times over the course of The Dresden Files, mostly by supernatural forces. Most non-humans, and even some magical humans, eschew guns in favor of claws, swords, or other melee weaponry, or specifically think to counter someone's magic ability when they do consider long-range combat, neglecting to consider firearms. At least one very powerful practitioner thought she had Harry dead to rights after disarming him of his staff and blasting rod, only to learn a little too late that they should have taken his gun too.
Also, Kincaid remarked to Harry that, if he wanted to kill Harry, he would use a high powered sniper rifle from a long distance away, neatly avoiding any Death Curse.
Hiro Protagonist's weapon-of-choice in Snow Crash is a katana. At one point, Hiro's use of the katana actually leads to a standoff when he's able to find cover that the gun-wielding mooks he's fighting with can't shoot through, but they're all too far away for him to attack. He actually taunts his adversaries that they can take as long as they like because "Katanas don't run out of bullets."
In Michael Flynn's The January Dancer, the owners of the ammunition factory try to avert this by burning it down and then parting for opposite sides of the civil war. This means that when an outside force intervenes, bringing a gun to the knife fight, she tramples all resistance.
Reagan: Ahh. Smarrrt—you target them because they are the officers, right?
Shaftoe: No, fuckhead! You kill ’em because they’ve got fucking swords! You ever had anyone running at you waving a fucking sword?
A Song of Ice and Fire kindly reminds you not to bring an army (or three) to a dragon-fight. Or, build the continent's most impressive, land-assault-proof castle and hole up in it when facing flame-throwing, aerial attacks. Conversely, don't bring a dragon to the environmental dream of guerilla warriors everywhere consisting of expansive deserts and mountains. Also: don't expect a normal fight when facing armies of the self-recruiting undead. You are also further advised to keep General Winter in mind when holding a war in The North and pack decent cloaks, coats, snowshoes and/or a trusty mule-train able to use and/or carry them all, rather than warhorses that can't do either. That is all.
Big Bad: Only a heathen brings a gun to a sword fight.
Skuldugger: Only a moron brings a sword to a gun fight.
In The Prince of Thorns Jorg challenges someone to a duel, runs away, snatches a guard's crossbow, and shoots him with it.
In King of Thorns he spends every day for years practicing his swordplay, because he intends to challenge a renowned swordsman to a duel, and given his reputation he needs the guy to think he means it or he'd never accept the challenge. Then he invokes I Am Not Left-Handed and switches his sword to the other hand, which is another misdirect; he needs his right hand for the scavenged gun.
In an episode of Chuck, Chuck and Sarah are attacked by three henchmen. One of them pulls out a knife, but they are saved by Chuck's mom, who shoots them dead.
In a recent adaptation of Macbeth starring Patrick Stewart and set in the 1930s, Young Siward charges Macbeth with a knife, only for Macbeth to draw a pistol and shoot him.
In an episode of JAG an ambitious lieutenant sneaks aboard an enemy ship. His request for a firearm was denied, so he only has a pipe on hand. He meets Col. Mackenzie who asks him, "Who brings a pipe to a gun fight?"
In the pilot episode, the squadron commander uses the knife and gun as a metaphor for the weapons systems on his F-18 versus the one on the bad guy's plane; the bad guys using a knife (gun cannon) to his gun (sidewinder missile).
In Red Dwarf Lister and a simulant go to "parley". The simulant pulls out a knife. Lister pulls out a pipe. The simulant pulls out a gun.
Lister: I didn't think of that.
In the Law & Order: Special Victims Unit episode "Burned," a man accused of setting his wife on fire pulls out a butcher knife during a standoff with several cops. When he starts to lunge toward them, Benson shoots him in the chest - using plastic bullets to bring him down without killing him.
McKay in Stargate Atlantis is cornered by the Genii into finding the location of all the pieces of a device to reveal a Zero-Point Module. Upon finding it on a wall-sized map, he asks for a knife, which the Genii are reluctant to give.
McKay: You all have guns. Someone give me a knife.
Stargate SG-1 played this straight in an early episode where Carter gets roped into what she thinks is a ritualistic hand-to-hand fight, until her opponent pulls out a huge sword. She equips her combat knife and manages to kick the guy's butt anyway.
Examined on MythBusters (Ep. 188, aired June 10 2012) in two ways, one with a guy throwing a knife, and one with a guy charging with the knife. They found that while a moderately-trained knife thrower could throw one before getting hit by the shooter, the shot is quicker and the shooter can dodge the knife; on the other hand, they found that charging from a distance of 16 feet, you could stab someone shooting at you without getting hit. Long story short: Busted. But just barely.
Stated on Teen Wolf by Chris Argent as "Never bring claws to a gun fight." The fight ends with Boyd getting shot.
Parodied in a sketch from In Living Color! where the street gang from the musical West Side Story runs into a modern urban street gang. The leader of the West Side Story gang pulls a switchblade, and the leader of the modern urban street gang responds by pulling a handgun and shooting a member of the West Side Story gang. Naturally, this causes the West Side Story gang to beat a hasty retreat.
In one episode of Person of Interest Reese's opponent realizes that he can't beat him hand-to-hand, so he pulls out a knife. Reese promptly draws his gun and kneecaps him.
It doesn't get much blunter than "Gunfight" by Sick Puppies:
Don't bring a knife to a gunfight - you'll lose!
In Act III of Tchaikovsky's 1884 opera, Mazeppa (or Mazepa), a very dark opera, anti-hero Mazeppa has managed to accidentally destroy everything Andrei cares about, including driving the woman he loves to insanity, killing her father, and destroying the thriving manor house we saw in Act I. Andrei challenges Mazeppa to a duel, and, when he tries to refuse, runs at him with a sabre. Mazeppa shoots him. That makes this one Older Than Radio.
In one production of Don Giovanni, at the end of the first act Don Giovanni, confronted by his pursuers, draws his sword — only to find that Don Ottavio brought a pistol. Giovanni decides it's a good time to be elsewhere.
In Alpha Protocol, one of the possible bosses is "Championchik", a Dumb Muscle Olympic boxing champion turned bratva who only uses his fists. Gunning him down is the easy way to win, and Mike will say a variation of the line if you go this route.
In the first game, you're likely to get your arse kicked trying to punch out armed enemies unless it's one-on-one as Altair can't disarm them.
Ezio's hidden gun lets him shoot up melee-armed mooks with ease.
Assassin's Creed III: The sword-wielding Officers and Jagers will cut Connor up if he tries to punch them while they're still armed. It's an automatic counter too. Fortunately, it works to your benefit too; Jagers and Grenadiers/Highlanders that would easily counter Connor to death if going weapon-to-weapon are much easier targets once Connor's the only one with a weapon.
During Cross's final confrontation with Desmond, despite just going through dozens of Abstergo Mooks armed with batons and guns with nothing but hidden blades (although Desmond can pick up guns and use them), the cutscene has Desmond dive for cover as soon as Cross shows up and starts firing his gun. Cross then walks slowly to Desmond's cover while mocking the Assassins' tendency to stick to their traditional weapons instead of "upgrading". In fact, Desmond would most likely be dead had Cross not suddenly had a bad case of the "bleeding effect" and started spouting in Russian of his long-dead ancestor.
In the TurboGraphix-16 game Bloody Wolf, there's a sub-boss on the fifth level who uses a knife, who you have to fight with your own knife despite carrying a machine gun. You encounter him again in level eight, when you can simply shoot him, causing him to go down in one hit.
In Civilization, civs with military technology an entire era behind yours will sometimes declare war on you and be easily destroyed. Of course, there are also aversions where Spearman Beats Tank.
In Destroy All Humans!, a cop will randomly say, in thought, "What would Eliot Ness do? Never carry a knife to a gunfight? No, that's not it..."
Gilgamesh plays with this in Final Fantasy XIII-2. He enters the fight with an arsenal of rocket launchers and handguns to fight the main heroes, who use a sword and a bow-sword. However, as a Spirited Competitor he finds that using the guns isn't giving him a satisfying battle, so he tosses them away during the fight and grabs an arsenal of various swords instead.
Grand Theft Auto: San Andreas. No matter how many guns the player has when invading Madd Dogg's mansion for the first time, he ends up with just a knife. The player is not even allowed to pick up dropped weapons until half way through. A much later mission ends with a helicopter crash leaving the water-treading protaganist outside of the ship he has to infiltrate. All his weapons (sob) are at the bottom of the drink except his knife. However, here, a quick swim to shore and knowledge of respawning weapon locations makes the ship much easier to overcome.
Mass Effect 3: Garrus mentions this trope by name when fighting Cerberus Phantoms, finding the whole concept silly. As Garrus is a sniper, the amusement is justifiable. But God help you if they get into melee range...(then DLC gave us sword-wielding characters to use in multiplayer).
Portrayed rather realistically in Spec Ops: The Line with the bayonet specialists. The player can gun them down easily enough (although they're fast and move/roll around erratically), but if they do manage to get within arm's reach, they'll probably win, particularly on higher difficulties.
In Team Fortress 2, you get an achievement for the Spy by fatally knifing another Spy who has his gun out.
The Scout plays this straight with his domination line "Don't bring a wrench to a gun fight."
Everywhere in Time Commando. Any weapon, even a dinky dagger, is almost always preferable to unarmed combat. Certainly, your enemies will not hold back.
In one possible ending of Yo-Jin-Bo, the main characters — who are mostly samurai and armed with swords — are attacked by ninja with guns. The heroes die very quickly.
Marble Hornets. In Entry #50, we see that Jay starts to carry a pocket-knife with him whenever he goes somewhere with Alex in case he tries to pull anything. In Entry #52, we discover that it doesn't actually help as Alex had a gun the whole time and attempted to kill Jay with it.
Discussed by Movie Bob with regards to the Old Boy remake. A criminal gang in South Korea should carry assorted improvised hand weapons. Guns are hard to get for street criminals there. Anyone trying to take on an American gang with a hammer should have run into this trope headlong, especially in the Southern USA, where guns are plentiful, legal, and cheap. The fact that Spike Jonze decided to just recreate the hammer scene and thus ruin suspension of disbelief showed Jonze was failing to make the material his own rather and was instead just making a beat-for-beat dull remake. Averting this trope meant the movie was being lazy.
This may be inverted in Real Life if the knife-user is skilled and/or the gun-user isn't. Opinions differ on the details, but at very close ranges the one with the knife has a lot of advantages, which is compounded by the fact that outside of the police/military, people often massively overestimate their own ability to use a gun effectively.
All things being equal, guns are better at distance of 10 m or more. At 3 m or less, the knifeman really may win. Between 3 and 10 m, everything depends on the gunman's skills (or rather lack of them). Most people are able to shoot only one shot at the time a running man can cover that distance, and if it misses, the knifeman has the edge. People not trained on handguns are likely to miss against a moving target, even at short distances. This is consistent with the results of the MythBusters experiment above, where a gun-wielding Adam Savage had the advantage over a knife-wielding Jamie Hyneman at 20 feet (~6 meters), but not at 16 feet (~5 meters).
One of many reasons the bayonet was invented. Shoot if he's far, stab if he's near.
What many people, including above, miss about the Tueller Drill is that 21 feet, or whatever, is the distance at which a person with a melee weapon becomes a threat to a gunman. Somewhat later on, people added the notion of the knife "winning" from some distance below that, which is very far from reality: someone with a gun is a lethal threat from maximum effective range down to 0.0m. Essentially, the gunman can shoot an assailant at any range, including point-blank, with closer shots being more debilitating due to the greater bullet penetration. The distance measurements are more about disabling the assailant without getting stabbed at all, and the actual chance of the assailant both executing a stab and not taking severe return fire afterwards. The human body is all but guaranteed to retain motor functions to complete draw-and-shoot even after a hit, but they are never ones you'd want to bet on. In other words, there are techniques to defend against a knife-wielding runner-in, but no sane martial training suggests knife-wielding running-in as a viable method of countering a firearm. More than once in one's life, anyways.
One has somewhat better odds with slightly larger melee weapons; being hacked with a sword or axe or smashed with a club does tend to interfere with return fire, though certainly not enough to make it a sure thing or even a particularly good idea.
Hence why US soldiers are trained to use their rifles as total weapons, in case someone comes at them with an axe, sword, club, etc.
Also, close combat weapons could actually be superior to guns in certain environments, such as close quarter battles inside buildings. There's a reason why soldiers involved in urban combat like to bring weapons like knives and hatchets.
It can also depend on the firearm. Urban combat specialists use extremely short barreled weapons for this reason. Trying to maneuver around with a full-size rifle inside of a building full of obstacles can be very difficult.
Similarly, more primitive firearms (of the kind that existed a few hundred years ago) tended to be very inaccurate and took a long time to reload, making them much less effective in close quarters than modern firearms; if your first shot missed, you probably wouldn't be able to get a second one.
Also, not counting pro-gun places like USA getting a gun is difficult and expensive (including the constant need of bullets) . On the other hand, a knife can legally be bought without any kind of monitoring. Thus making a knife a more reliable weapon and justifying the invention of waraxes as the farmers already had those.
Most places but a limit to the blade length of a legal knife (8-10cm) you can have. Exception is made to hunters and kitchen workers (chefs and cooks) but only if on job location, coming to job location or going home.
After speaking to several WWII vets, the phrase they were always terrified to hear was "fix bayonets"