Hi I have written below script .
#! /usr/bin/expect
set timeout 180
spawn /vobs/iov/rnc/bin/moshell/moshell -d db.dat
expect {
-re "OFFLINE_DB.DAT.*" { }
timeout {
error "\n######## Timeout - when logging in\n"
}
eof {
error "\n######## eof - when logging in\n"
}
}
set db_prompt "SQL>"
send "select id from motype_r1 where data = 'PlugInUnit';\r"
expect {
-re "OFFLINE_DB.DAT>"
}
exit
Now , I want to get the output of the table in a variable i.e
+------+
| id |
+------+
| 19 |
+------+
Query Done: 1 record selected
and match regular expression to get '19' in one more varible.
Can anybody please help me with the solution.
/Akshya