java - Bash non scrolling terminal output -
some programs produce output bash in way user experience strings changes values rather rows printed(bash scrolls down able show changing output). phenomena called? how achieved in e.g java program or bash script. how can output parsed? printing new lines using special function?
top 1 program uses "phenomena" of outputting data
okey cursors used.
then how can parse them in java? tried code not print anything
public static void exetest(string [] args) throws ioexception{ if (args.length <= 0) { system.out.println("empty command"); return; } process process = new processbuilder(args).start(); inputstream = process.getinputstream(); inputstreamreader isr = new inputstreamreader(is); bufferedreader br = new bufferedreader(isr); system.out.printf("output of running %s is:", arrays.tostring(args)); string line; while ((line = br.readline()) != null) { system.out.println(line); }
thanks answers, im more familiar @ topic thou still cant parse program output 1 top in java. ill close question , more research how parse in java. may start more specific 1 parsing output in java.
instead of printing whole lines (as println
or printing %n
), write backspace characters (\b
) or bare carriage returns without linefeeds (\r
) move cursor in front of want print over.
Comments
Post a Comment