Closed vinllen closed 6 years ago
These characters are terminal control symbols (see: https://en.wikipedia.org/wiki/Control_character). You can simply filter them in your application.
Sometimes an application that produces such formatting can detect that its standard output isn't a terminal and can suppress control symbols. In such case, in Linux/Unix, you can run this application this way:
application | cat
to avoid control characters.
Thanks, Ziutek, you're so nice. I move this question to my workmate who is downstream of me. He tries to parse all the control characters and solve this problem.
Hi, Ziutek. Maybe it's not proper to ask this question here, but it really confused me for several days. I want to remove all control characters in the telnet output because there are too many special characters over there. For example, the telnet output is:
There are some extra characters including non-printable and printable like
^[
,^H
,^M
,[J
,--More-- (END)
and so on. But this output is normal when printing on the screen:All the control character are not shown. I know there is a way that uses
col -b
bash command to remove them. But it's not an effective way because telnet is an interactive way. Usingos.exec
to filter control characters for every command is not good. So do you have any idea to remove all the control characters on the telnet output?