0

After executing a command

if {[execCmd -cmd "xstatus call status" -expectingValue OK -waitTime 5]} {
puts "the Buffer value after executing the command is something like this>>>>>>>>>>>>>>>>>>$buffer<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
}

i got the output as

the Buffer value after executing the command is something like this>>>>>>>>>>>>>>>>>>): 
** end
xstatus call status
*s Call 161 Status: Connected
** end

OK<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Now i need the integer value to be extracted from it. How to do it ? I have tried many things but it is not working.

1 Answer 1

2

You can try it like

puts [regexp -inline {\d+} $buffer]

\d will match the any numerical value from 0 to 9. + will match one or more occurrence. So together, \d+ will match one or more occurrence of numerical values.

Have a look at Tcl's man page of regexp, to know more about the same.

Note : We are happy to help you out. But, always show us the code which you have tried.

Sign up to request clarification or add additional context in comments.

4 Comments

so if i use puts [ regexp -inline {\d+} $buffer ]; it will search whole output or a particular line, there is no need to break the line and all
It will search in the whole output. No need to break the line.
@Hoodiecrow : Thanks Hoodiecrow. I have updated the answer and will follow those.
Thanks. It's details, but they matter. Nice answer btw.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.