Remove carriage returns using Scanner
From MyWiki
The headers of the Janet csv file
0 "Request ID", 1 "Common Name", 2 "Renewal Date", 3 "Requested By", 4 "Certificate Type", 5 "CSR SANs", 6 "Extra SANs", 7 "Certificate Expiry Address", 8 Status
File file = new File("yourFilePath.txt"); // create File object to read from Scanner scanner = new Scanner(file); // create scanner to read Printwriter writer = new PrintWriter("someOutputFile.txt"); // create file to write to while(scanner.hasNextLine()){ // while there is a next line String line = scanner.nextLine(); // line = that next line // do something with that line String newLine = ""; // replace a character for (int i = 0; i < line.length(); i++){ if (line.charAt(i) != '*') { // or anything other character you chose newLine += line.charAt(i); } } // print to another file. writer.println(newLine); }