TCL expect out string with multiple lines

Hello,

I will be sending this command to a specific COMID:

exp_send-i  $COMID "fdisk -l | grep Disk | awk '{print $2}'"

The command will produce this output:

/dev/sda
/dev/sdb
etc..

the problem is how do I store the output in a variable in TCL,

I am currently using this to grab the text:

expect -i $COMID -re "(\[A-Za-z]+)" {
    set disks $expect_out(1,string)
}
puts "disks = $disks"

but I can only get 1 string from the command; output is like this:

"disks = fdisk"

thanks!!

---------- Post updated Aug 16th, 2012 at 01:32 PM ---------- Previous update was Aug 15th, 2012 at 01:44 PM ----------

no reply? :frowning:

---------- Post updated Aug 17th, 2012 at 09:12 AM ---------- Previous update was Aug 16th, 2012 at 01:32 PM ----------

anyone?

Try something like this:

send "fdisk -l | grep Disk | awk '{print \$2}'; echo NOW_DONE\r"
expect -r ".*echo NOW_DONE\r\n(.*)\nNOW_DONE" {
        set disks $expect_out(1,string)
}
puts "disks = $disks"