Remove ANSI color codes from a text file using bash

前端 未结 3 1958
南方客
南方客 2020-12-20 12:15

I have a bash script that runs and outputs to a text file however the colour codes it uses are also included what i\'d like to know is how to remove them from the file, ie

3条回答
  •  温柔的废话
    2020-12-20 12:40

    Does this solve the issue?

    $ echo "^[[38;1;32mHello^[[39m" | sed -e 's/\^\[\[[0-9;]\{2,\}m//g'
    Hello
    

    cheers!!

提交回复
热议问题