According to Wikipedia, the [m|K]
in the sed
command you’re using is specifically designed to handle m
(the color command) and K
(the “erase part of line” command). Your script is trying to set absolute cursor position to 60 (^[[60G
) to get all the OKs in a line, which your sed
line doesn’t cover.
(Properly, [m|K]
should probably be (m|K)
or [mK]
, because you’re not trying to match a pipe character. But that’s not important right now.)
If you switch that final match in your command to [mGK]
or (m|G|K)
, you should be able to catch that extra control sequence.
./somescript | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g"