Paste or upload G-code, choose cleanup options, then export a cleaner file (without changing motion commands).