Convert output to csv format