Removing ANSI escape sequences from a log file

Just another small note for self, from https://stackoverflow.com/questions/17998978/removing-colors-from-output. Frequently when recording the screen output with e.g. "script", I end up with the screen log full of ANSI escape codes... not so useful for later processing. A "simple" sed command to deal with this:
cat logfile | 
  sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"
Index of /blog/2018-08-10-Removing-ANSI-escape-sequences-from-a-log-file/

Index of /blog/2018-08-10-Removing-ANSI-escape-sequences-from-a-log-file/


../
HEADER.txt                                         01-Jul-2024 21:41                 544