Is there any common Linux utility or easy shell script that I can use to launch apps such that anything they print to stdout/stderr that would affect the terminal behavior (perhaps w/ an option to leave colors) gets filtered out? 'less' has an option for this, -R, but I'd like to be able to launch arbitrary programs with this filtering, for example:
termfilter ./mybuggyapp
And termfilter would take care of filtering any non-color non-printable chars on both stdout and stderr, but still let me use pipes, redirection, etc. to send that output around. Or even better, if it only did the filtering when it detected stdout/stderr weren't connected to a TTY.
Obviously, this would break apps that need to send such control codes (like screen, ncurses GUIs, etc.) but I mostly want it to protect myself against bad programming in apps that are only intended to print standard ASCII text.
cat -v(or tr that deletes control characters other than LF and tab). Then you can still use further redirection/pipes – RedGrittyBrick Aug 28 '12 at 20:39