|
Is it possible to control VI with tcl and expect ?
I'm using expect to log into a remote server and run a script. I want to able to have expect edit the output from that script, on the remote server, in VI.
Has anyone ever done this before, it seems as though the expect interpreter has nothing to expect once VI is started, the file pointer starts at the beginning of the line, and expect usually reads the characters before the pointer.
spawn ssh user1\@$remote_server
expect "password: "
send "$password\r"
expect "$ "
send "cd /data/home/user1/bin \r"
expect "$ "
send "/data/bin/script1.pl > report1.txt\r"
expect "$ "
send "vi /data/bin/report1.txt\r"
###This is where I get lost on what to have it expect
###Can you expect nothing ("") ?
###Can you have multiple "send" commands without expect
####in between?
expect ""
send {:g/search string/s/1.*0//}
expect ""
send "\r"
expect ""
send {:v/./d}
Any thoughts at all are appreciated!
Thanks,
Mark
|