Read file with exceptions
Rewrite reading file as onelinner
Write to file

Quick and dirty solution