01-13-2014 04:11 PM
Hi,
I have the following string from a cli command output:
630860 packets input, 624821204 bytes, 0 no buffer
I want to select the number of bytes which is of a variable length. Is there a way to do this with the action string commands? I couldn't get this to work for me.
Kind regards,
Ryan
Solved! Go to Solution.
01-13-2014 04:17 PM
Use regexp:
regexp "([0-9]+) bytes" $string match bytes
puts "Bytes is $bytes"
01-13-2014 04:17 PM
Use regexp:
regexp "([0-9]+) bytes" $string match bytes
puts "Bytes is $bytes"
01-13-2014 05:29 PM
Ok this works.
What do the ( ) brackets indicate? I had tried a similar string in the past but I didn't have these brackets.
Ryan
01-14-2014 07:22 AM
They indicate that you want to extract a sub-match, in this case the number of bytes.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide