ANSI escape codes from RTF-document to .odt / .ott

I have got a series of RTF documents with ANSI escape codes (codes colorize the font). Content should be imported to one or more .odt based on .ott in the form as RTF with ANSI escape codes aim to present it.
The manual proceeding so far looks as the description below however I like higher level of automation as this kind of text blocks should have uniform look&feel across all .odt in current focus. Primarily I mean a paragraph style based control.
Text after import to .odt should have font colorized as in RTF. My plan was to use dedicated paragraph style however unsure how to combine those styles along with importing reach-formatted text from RTF document open in Writer.
It is style-based writing, mainly (custom modified) default paragraph and character styles however also custom paragraph and character styles in use, Also page styles in ues. Other style classes rather not used.

Manual procedure
Opening RTF in Writer, manual modification of paragraph background (desired paragraph background color), copy&paste to target .odt.

EDIT
ANSI escape codes as those used in computer shell terminals (Linux) to colorize words, phrases, tokens in terminal window. AI hinted that the name is ANSI escape codes.

EDIT 2
RTF get created by following means, in a sequence of steps as presented

  • Use in terminal window the CLI tool ‘script’ to redirect sommand stdout (stderr possibly too) to .txt and .ltim, e.g.
    $ script -c "sudo cat /etc/cloud/cloud.cfg.d/99-xyz.cfg" --log-io cloud-init-2.txt --log-timing cloud-init-2.ltim --logging-format advanced
  • Use CLI tool ‘ansifilter’ to convert got .txt into .rtf, e.g.
    $ ansifilter -i ./cloud-init.txt -o ./cloud-init--by-ansifilter.rtf --rtf
  • continue as presented in this question

EDIT 3
Due to procedure used (edit 2) the .rtf open in Writer don’t seem to have ANSI escape codes any more. Rather ansifilter transformed them to RTF color control words.

What is RFT? Thought it could be mistyped “RTF”, but repeated six times - a typo is unlikely.

That question could clarify, what “ANSI escape codes (codes colorize the font)” could mean.

Though a typo. Thanks for hint. Fixed and question answered now.

Hm. An interesting mix of a very sophisticated document format (RTF) capable of any formatting, and terminal codes.

Since RTF is a plain-text file format, it could be possible to create a script to pre-process the RTF, replacing e.g. \033[31m with {\cf1, and \033[0m with }. Of course, the color must be in the \colortbl (you may want to add needed colors there beforehand). If you have multiple opening codes, and a single closing, then you would need to count opening ones, and replace the closing one with respective number of }

I think a “typical” example file would be useful for a more specific discussion.

If possible, upload the test example in RTF format and the target file in .odt format.

(post deleted by author)