A '''[Terminal] Control Code''', AKA '''terminal escape sequence''', AKA '''terminal control sequecence''', is an in-band sequence of bytes that may be interpreted by a character imaging device such as a terminal. ** See Also ** [Terminal]: ** Reference ** [http://www.ecma-international.org%|%ECMA]-[http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf%|%48: Control Functions for Coded Character Sets:]: [http://en.wikipedia.org/wiki/ANSI_escape_code%|%ANSI escape code], [http://wikipedia.org%|%Wikipedia]: [http://www.termsys.demon.co.uk/vtansi.htm%|%ANSI/VT100 Terminal Control Escape Sequences]: [http://invisible-island.net/xterm/ctlseqs/ctlseqs.html%|%XTerm Control Sequences], by Edward Moy, Stephen Gildea, and Thomas Dickey: [http://sydney.edu.au/engineering/it/~tapted/ansi.html%|%ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals in alphabetic order], by mnemonic: ** Description ** The most common set of control codes, known as '''[ANSI] escape sequences''', and standardized in control set is ** Example: [ANSI] Sequences ** [AM] 2014-05-06: The other day someone asked about controlling the output on screen, so that the last line would be rewritten with new results. Here is a simple solution which works with these ANSI escape codes. Unfortunately you only get the proper effect on Linux terminals and other ANSI-enabled terminals. The code is, however, dead simple: * Move the cursor to the right position (\escape[[10;0f) * Clear everything at this position and below (\escape[[J) * Write the new output ====== # showcomp.tcl -- # Small program to illustrate the use of ANSI sequences # while 1 { puts -nonewline "\x1b\[10;1f\x1b\[J" puts "Result: [clock seconds] - [expr {rand()}]" puts "Computing ..." after 1000 } ====== <> Terminal