Reputation: 249
I have extracted some data from a tabular column using "lsearch" and now have a TCL variable like this
{ 1 no8 MASTER (UP-DOWN) ABCD 1456 /clown F right_left_123 /local/opt/data WXYZ (M5,N6) }
How can I now use "regexp" to grab each of these values into separate variables? I guess I will have to filter by space, but the blank space between these values are variable.Also, I am a "regexp" newbie.
I tried using "lindex" but looks like the entire element is in index 0. Please let me know what is the easiest way.
Upvotes: 1
Views: 207
Reputation: 71538
lsearch
has probably returned a list containing this 1 element. If you want to now get the elements inside this element, use a second index, to go 1 level deeper:
# suppose the list in in the variable $l
puts [lindex $l 0 0]
# => 1
puts [lindex $l 0 1]
# => no8
Upvotes: 2