strip out VT100 control characters from a log file
772
I've got a file that's full of VT100 color codes, which is making it hard to search. Is there a unix utility that can strip those out so I'm left with plain text?
I remember there was a script that did exactly this on some system I used to have access to... I think it was the University of Waterloo Math Department's Unix machines.
But I think some clever bastard there wrote it a while ago. Find a friend still at UW :)
Try catting it through
col -b
cat file | col -b
This works for stripping the troff/nroff formatting for man pages. Worth a try.
If that doesn't work, there's quite a good thread on perlmonks:
http://www.perlmonks.org/?node_id=132997
This might help:
the strings command possibly!
Trying to cleanup the output of a
script
run?I remember there was a script that did exactly this on some system I used to have access to... I think it was the University of Waterloo Math Department's Unix machines.
But I think some clever bastard there wrote it a while ago. Find a friend still at UW :)