Is there a way to read in and process control characters like ^M and only show the final output? For example, I have the following string:
track^Mfl^Ms
I would like to convert it to:
slack
How could I go about doing this?
It is already mentioned in the comments but it probably should be the answer:
col -bshould help
\r/^M is not the only control character/sequence it recognises. The BSD one (often the one also found on Linux-based systems) interprets the input as a Teletype Model 37 would (not like modern terminals would). In particular SPC does not erase, it moves the cursor forward one position, so abc\rA C would render as AbC, not A C.
col -bshould help.