Hi All,
I have a requirement where I need to read a file with so many carriage return line feeds.
Attached is the file I am reading.
I have written a sample application to read the file and and remove these new line feeds but when I execute it, I see the line feed.
import java.io.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = null; PrintWriter sb = null; try{ br = new BufferedReader(new FileReader("C:/Users/rejalu/Downloads/ATG/SubmittedOrders/2010/testfile.txt")); sb = new PrintWriter(new FileWriter("C:/Users/rejalu/Downloads/ATG/SubmittedOrders/2010/testfile3.txt")); String I; while((I = br.readLine())!= null){ sb.println(I.replaceAll("[\\r|\\n]+", " ")); } } finally { if (br!=null) { br.close(); } if (sb != null){ sb.close(); } } } }
Is there away to achieve this in attached output file?
This is just one record, but I have several records like these.
Thanks for your help.
Ron