I have problem with my tcl script. In one part of code I grep one string form xml.file containing ipadress (see below), and now I need to match the expression with expect -re i next line, so that I can save it to varible. So I need your help, how to match this, see below what I mean. This is part of code in TCL:
send -- "cat $filename | grep 'url' \r"
expect -re "(\<emUrl url=\"(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})\"\/\>\).*ranosusr@rn2osscs603>$"
set IP $expect_out(1,string)
probelm is that I don't know how to match this experssion, wich is the result of grep:
<emUrl url="10.80.31.123"/>
the ipaddress should be general, because they are different from file to file.
With exp_internal 1 I get this ouput:
end: sending "cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url' \r" to { exp4 }
expect: does "> " (spawn_id exp4) match regular expression "(<emUrl url="(.*)").*ranosusr@rn2osscs603>$"? no
cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url'
expect: does "> cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url' \r\r\n" (spawn_id exp4) match regular expression "(<emUrl url="(.*)").*ranosusr@rn2osscs603>$"? no
<emUrl url="10.80.31.123"/>
expect: does "> cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url' \r\r\n <emUrl url="10.80.31.123"/>\r\r\n" (spawn_id exp4) match regular expression "(<emUrl url="(.*)").*ranosusr@rn2osscs603>$"? no
ranosusr@rn2osscs603>
expect: does "> cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url' \r\r\n <emUrl url="10.80.31.123"/>\r\r\nranosusr@rn2osscs603> " (spawn_id exp4) match regular expression "(<emUrl url="(.*)").*ranosusr@rn2osscs603>$"? no
expect: timed out
expect: does "> cat FXL704_FRTAMX_SIU_ARNE.xml | grep 'url' \r\r\n <emUrl url="10.80.31.123"/>\r\r\nranosusr@rn2osscs603> " (spawn_id exp4) match regular expression "(<emUrl url="([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})"/>).*ranosusr@rn2osscs603>$"? no
expect: timed out
so take a look at my code, I think maybe some brackets are needed that I can't figure out. Also I have to include ranosusr@rn2osscs603> because this is the server prompt.
Please help :)