On Tue, Nov 28, 2006 at 04:31:35PM +0100, Nikolaus Schulz wrote: > IMO there really should exist a utility to strip such ANSI control > sequences. The best I've found so far is a small program by James > Carlson, see the usenet thread "VT100 to text utility" at [1].
Hm, sorry, I should have noted that this utility (which the author christened 'novt') isn't enough here, because it is limited to filtering out vt100 control sequences; but the attached bash snippet from my ~/bin completes the job nicely. > Hmm, Joey, do you think something like this would qualify for moreutils? > > Nikolaus > > [1] http://groups.google.com/group/comp.terminals/msg/1fdc79377950d045 Nikolaus
#!/bin/bash # # unscript: clean up typescripts. # 'novt' is by James Carlson. # sed/tr pipeline from a ksh script by Robert Katz. # (No, 'col -b' doesn't do it.) B=$'\b' novt "$@" | sed " :x s/[^$B]$B// t x" | tr -dc '[:print:]\t\n'