I sarched the existing threads but didnt find an answer to this. I am writing simple script which uses telentlib to open a session with a unix machine and run "tail -f logfile.txt" on one of the logfiles.
import telnetlib HOST = "192.X.X.X" user = "myname" password = "mypass" tn = telnetlib.Telnet(HOST) tn.read_until("login: ") tn.write(user + "\n") if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("tail -f /tmp/logfile.txt\n") # what do i write here ? # tn.write("exit\n") I want to read every line of the output into a string and run regex on it. I tried tn.interact() which does show me the ouput but the CPU usage on my win2k machine reaches 99% !! :( How do i execute a command and then read its output, then another command and read its output and so on. I tried to find docs on telnetlib but in vain. Can somebody guide me please Thanks Nitin -- http://mail.python.org/mailman/listinfo/python-list