I've been searching for hours and trying multiple things. This is the expect code snippet which works.
foreach line [split $expect_out(buffer) \r\n] { if {[string match {*word*} $line]} { send_user "$line\r\n" set acctnum [exec echo $line | cut -d\. -f1] send_user "$acctnum\n\r" } }
The output is:
2. word2
"word" without the asterisks and "word" with an asterisk on either end does not work. I need this to be a variable which is provided on the command line. I have found no combination which will work with a variable.
Please provide suggestions to get this to work.