how to read remote file
From: rashmi (nsrashmi_at_gmail.com)
Date: 03/30/05
- Next message: abhishekkabra_at_gmail.com: "Re: issues with expect -send: spawn id exp4 not open"
- Previous message: rashmi: "issues with expect -send: spawn id exp4 not open"
- Next in thread: abhishekkabra_at_gmail.com: "Re: how to read remote file"
- Reply: abhishekkabra_at_gmail.com: "Re: how to read remote file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Mar 2005 01:59:13 -0500
1.login to the other system
2.then open file
3.search for a string
4.return the search results
to the above set of tasks i tried using
spawn ssh -l "root" "mysystem"
expect spawn_id
expect "Password:"
send "90909\r"
expect "*#"
set file [ open "/tmp/hostname.org" "r" ]
while { [gets $file buf] != -1 } {
puts $buf
if { [ string match "*string*" $buf ] } {
stty -echo
send "echo"
}
}
but i found this does'nt work can instead i'm using traditional cat ,grep
,echo $? ,expect 0/!=0
method.
Does any one have the better way?
- Next message: abhishekkabra_at_gmail.com: "Re: issues with expect -send: spawn id exp4 not open"
- Previous message: rashmi: "issues with expect -send: spawn id exp4 not open"
- Next in thread: abhishekkabra_at_gmail.com: "Re: how to read remote file"
- Reply: abhishekkabra_at_gmail.com: "Re: how to read remote file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|