Change the script generate_errors.pl to call the grep function in Perl instead of calling the external tool grep directly as this causes problems when ANSI escape sequences are included in the grep output string.