Java tutorial
import java.io.File; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { File file = new File("data.txt"); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); Scanner lineScanner = new Scanner(line); lineScanner.useDelimiter(","); while (lineScanner.hasNext()) { String part = lineScanner.next(); System.out.print(part + ", "); } System.out.println(); } } }