I am writing a java program that reads a flat file and process each record. I am maintaining a counter that keeps track of the record/ line being processed.
I want to print this counter on the monitor screen. Using
System.out.printf("Processing Record: %d\r", counter);
is printing the the required string, but it is printing new output line for every counter value. Like this:
Processing Record: 1
Processing Record: 2
Processing Record: 3
and so on.
I want to overwrite the line continously and not write new lines. Like:
Processing Record: 1 (with the number being overwritten everytime a new record is processed)
Can someone show me how, please. I will be grateful if anyone can give some hints.