I am writing software that interacts with an embedded device running a version of busybox Linux. Basically, I am just sending commands to the device and parsing the output from the commands . The commands are executed either on the linux shell directly or on the command line of an in-house CLI application running on the device.
Everything works fine except that the output is peppered with terminal control escape sequences. On terminal applications such as teraterm or putty, these escape sequences do useful things like color errors red and other nice features for a pleasant user interface.
The problem is that I have to programmatically parse the output from the commands and account for things like "(esc)[2k" in the output.
For example, a typical send/receive interaction where I send a command, "my-cmd" would go like this...
[send] my-cmd [receive] my-cmd <esc>[2Kprompt> my-cmd output of the command prompt>
What I would really like to do is to turn off these escape sequences. Is this something that can be done on the command-shell at the beginning of a session? Or is there no way around this other than filtering the output?