Is it possible to rewrite previous line in console?
java
Solution
That depends on your console. Lot of consols support vt100 commands which allow e.g. changing the position of the cursor or change he color of text or background.
I use it a lot to make colored debug output in my java programs to the shell.
If the link is dead use this google search https://www.google.de/search?q=vt100+comands&oq=vt100+comands
Problem
I'm trying to create process animation in my console app. Is it possible to rewrite previous lines for this needs? I know about `\r` but it works only with current line. If it is not possible, how could I achieve animation effect? Thanks. My console is standard Ubuntu 12.04 terminal emulator. Thanks to @MrSmith42 I made this simple demo, which shows way to overwrite lines: ``` public class Flush { public static void main(String[] args) { for(int i = 0; i < 5; i++) { System.out.println("**********************************"); } // ESC[5A - cursor up 5 times // \r - cursor return to begin of line // ESC[J - erase to end of screen System.out.print("\033[5A\r\033[J"); for(int i = 0; i < 5; i++) { System.out.println("##################################"); } } } ```