In Java, of course. I\'m writing a program and running it under a Windows environment, but I need the output (.csv) to be done in Unix format. Any easy solution? Thanks!
Assuming the formatting issue you refer to is that Windows line breaks are Carriage Return-Line Feed ("\r\n"
) while Unix ones are Line Feed ("\n"
) only, the easiest way to make sure your file uses LF and not CRLF is to eschew println
and instead use print("\n")
to terminate lines.
So instead of:
writer.println("foo,bar,88");
use
writer.print("foo,bar,88\n");
You can just search the relevant files for println
to make sure you catch them all.