-4

I am trying to write a console output into a text file. I am able to write it but I do not want to write last few lines so is there any function to remove specific lines in console output.

1 Answers1

2

You can only "remove" current line overriding it with spaces. Just print CR (carriage return) which is \r in java. Then print enough spaces so the line will look clean.

There is no other way to remove certain number of lines. You can execute bash command like Unix clear or Windows cls - they will clean whole command line screen. Beware - on Unix it works differently then on Windows!

xenteros
  • 15,586
  • 12
  • 56
  • 91