Translate

Image of Modern Operating Systems (3rd Edition)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Operating System Concepts
Image of Linux Kernel Development (3rd Edition)

Remove Color Code Escape Sequences

Here is a simple way using sed to remove special characters such as color codes and other escape sequences from each line in a log file or the output from a utility like screen. $ sed -r “s/x1B[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g” If you wish to see the actual escape sequences, one way is to use the -r or -R options to the less utility -r or –raw-control-chars Causes “raw” control characters to be displayed. The default is to display control characters using the caret notation; for example, a control-A (octal 001) is displayed as “^A”. Warning: when the -r option is used, less