This project is read-only.

Remove Terminal Emulation Charaters

Jun 17, 2013 at 9:32 PM
MyRenci = New Renci.SshNet.SshClient("qwe315", "root", New SshNet.PrivateKeyFile(Environment.GetEnvironmentVariable("temp", EnvironmentVariableTarget.User) & "\id_rsa"))
    MyRenci.ConnectionInfo.Encoding = System.Text.ASCIIEncoding.ASCII
    If MyRenci.IsConnected Then
        MyShellStream = MyRenci.CreateShellStream("xterm", 80, 24, 800, 600, 1024)

        Debug.WriteLine(MyShellStream.Expect("~]# ", New TimeSpan(0, 0, 5)))
        Dim Data As String = MyShellStream.Expect("~]# ", New TimeSpan(0, 0, 5))
    End If

anaconda-ks.cfg Desktop install.log install.log.syslog kerb-list.txt
]0;root@qwe315:~[root@qwe315 ~]#

Like in SharpSSH, is there a simple way to remove terminal emulation char's?
Whats the best alternative?
Jun 23, 2013 at 5:03 AM
I am also interested in a solution for this issue. When i do "ls -l", I get a lot of control characters as part of the result. I would like to know how to clean them out.
ie: [0m

Any help would be appreciated, thanks.
Jun 23, 2013 at 11:47 AM
use "/bin/ls" as command, since ls is typically a alias to `ls --color=auto' on modern linux.

Don't know if there is a general way to remove terminal-color chars.
Jun 30, 2013 at 12:43 AM
Thanks da, I used your tip and found the following solution to remove all terminal-color char:

result = Regex.Replace(result, @"\e[\d*;?\d+m", "");

I hope someone finds this useful.