A file with an ASCII-art logo is bloated with 'rgb-black foreground space characters'. Vim shows them as
^[[38;2;0;0;0m ^[[0m
Can I get sed to substitute this with 'regular' space characters, and if so, how?
sed -i 's/\\033\[38;2;0;0;0m \\033\[0m/ /g' $FILE
doesn't do the job on Bash V5.2.15 (up-to-date Debian12 x86_64)
The escape character is not special to sed, and can be typed directly into a single-quoted string from the bash commandline as shown above. Ctrl-V should be replaced by whatever
stty -ashows is assigned aslnext.To avoid using literal escape characters (which probably won't survive cut&paste, etc), bash's
$''notation could be used with some doubling of backslashes:or moving them outside:
Standard
seddoes not understand escape (or hex) sequences like\033, although GNU sed does: