Lies, damn lies, and commercial CSV export modules. Who wrote these things? On what planet would this be acceptable? Whatever.
Name,What's wrong "Robert "Bob" Smith",quotes inside quotes Robert "Bob" Smith,quotes in the middle Robert Bob" Smith,unmatched quote
Ruby dies immediately trying to read it:
$ irb irb(main):001:0> require 'csv' => true irb(main):002:0> CSV.read('broken.csv') CSV::MalformedCSVError: Missing or stray quote in line 2
scrubcsv, a is a lightning-fast static binary written in Rust that best-effort parses CSV and then immediately dumps back out 100% guaranteed standards-compliant CSV. Top speed? About 67mb/s.
$ scrubcsv broken.csv > fixed.csv 4 rows (0 bad) in 0.00 seconds, 787.13 KiB/sec $ cat fixed.csv Name,What's wrong "Robert Bob"" Smith""",quotes inside quotes "Robert ""Bob"" Smith",quotes in the middle "Robert Bob"" Smith",unmatched quote
It uses BurntSushi's world-beating CSV parser which is almost certainly faster than your SSD.