Comment 1 for bug 1197582

Revision history for this message
Antonio Terceiro (terceiro) wrote : Re: UEFI shell color codes makes it impossible to parse output with pexpect.

We could filter the data from the serial line using this regular expresssion:

'\x1b\[[0-9;]*m'

An example:

$ cat /tmp/remove-ansi-codes.py
import re
import sys

input_file = sys.argv[1]

with open(input_file, 'r') as data:
    for line in data.readlines():
        filtered = re.sub('\x1b\[[0-9;]*m', '', line)
        print(filtered.strip())