Remove Terminal Emulation Charaters

Jun 17, 2013 at 8: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
    MyRenci.Connect()
    If MyRenci.IsConnected Then
        MyShellStream = MyRenci.CreateShellStream("xterm", 80, 24, 800, 600, 1024)

        Debug.WriteLine(MyShellStream.Expect("~]# ", New TimeSpan(0, 0, 5)))
        MyShellStream.WriteLine("ls")
        Dim Data As String = MyShellStream.Expect("~]# ", New TimeSpan(0, 0, 5))
        Debug.WriteLine(Data)
    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?
Thanks!
-Keld
Jun 23, 2013 at 4: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 10: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 29, 2013 at 11:43 PM
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.