That looks like a list of TclX keyed lists, which were an earlier attempt to do what modern Tcl does with dictionaries. Keyed lists nest quite nicely — that's a tree, not a table — so mapping to CSV will not be maximally efficient, but their syntax is such that the easiest way to handle them is with the TclX code.
Preliminaries:
package require TclX
package require csv; # From Tcllib
List the columns that we're going to be interested in. Note the .
separating bits of names.
set columns {
TOKEN.NAME TOKEN.GROUPS TOKEN.VALUE TOKEN.REPEATING.MAX TOKEN.REPEATING.TIME
TOKEN.WINDOW TOKEN.HOST TOKEN.ACTION.EXEC TOKEN.ACTION.email.FROM
TOKEN.ACTION.email.TO TOKEN.ACTION.email.SUBJ TOKEN.ACTION.email.MSG
}
# Optionally, put a header row in:
puts [csv::join $columns]
Loading the real data into Tcl:
set f [open "thefile.dta"]
set data [read $f]
close $f
Iterate over the lists, extract the info, and send to stdout as CSV:
foreach item $data {
# Ugly hack to munge data into real TclX format
set item [list [list [lindex $item 0] [lrange $item 1 end]]]
set row {}
foreach label $columns {
if {![keylget item $label value]} {set value ""}
lappend row $value
}
puts [csv::join $row]
}
Or something like that.