Text file manipulation into CSV