Hi folks and thanks for reading.
I am a newbie in both TCL and REGEX (ugh...lots to learn), so please be forgiving.
I did my research but couldn't find a match (hehe!) of what i need to do.
The problem:
I have a file that I'm parsing line by line in TCL
The file looks like this:
'point1 ' 'left/right' 0.0 -200.0 225.0
'point2 ' 'left/right' -200.0 -400.0 225.0
...
-> a name, a string with / and three numerical values.
TCL allows me to directly call the regexp command.
I would like to store the 5 entities in appropriate variables: name, symmetry, x y and z.
I have absolutely no idea on where to go from here. Can someone throw me a bone?
thanks!
Andrea
I am a newbie in both TCL and REGEX (ugh...lots to learn), so please be forgiving.
I did my research but couldn't find a match (hehe!) of what i need to do.
The problem:
I have a file that I'm parsing line by line in TCL
The file looks like this:
'point1 ' 'left/right' 0.0 -200.0 225.0
'point2 ' 'left/right' -200.0 -400.0 225.0
...
-> a name, a string with / and three numerical values.
TCL allows me to directly call the regexp command.
I would like to store the 5 entities in appropriate variables: name, symmetry, x y and z.
Code:
while {![eof $raw] } {
gets $raw line
if { [regexp \
{ --a string---a string--- a signed float --- a signed float --- a signed float }\
$line name symmetry x y z ]} {
puts $name
}
}
close $raw
thanks!
Andrea