Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Convert a CSV file into another CSV format.
public class CsvSplit
{
public static void main(String[] args) throws Exception
{
FileWriter out = new FileWriter("output.csv");
BufferedReader in = new BufferedReader(new FileReader("input.csv"));
String line;
while ((line = in.readLine()) != null)
{
String[] fields = line.split(";");
String name = fields[2];
String firstname = fields[1];
String kto = fields[3];
String blz = fields[4];
String amount = fields[5];
out.append(String.format("%s;%s %1$s;%s;%s;%s%n", name, firstname, kto, blz, amount));
}
out.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment