More specific info regarding the above discussion:
here is the file I am trying to convert into csv using tcl. this file is generated by Surpac 3D modelling software.
high_grade,10-Mar-12,,ssi_styles:styles.ssi
0, 0.001, 0.000, 0.000, 0.000, 0.000, 0.000
30007, 25615.414, 11208.269, 100.000, 5.72
30007, 25579.883, 11132.600, 100.000, 2.28
30007, 25548.000, 11148.000, 100.000, 18.68
30007, 25690.136, 11241.821, 100.000, 1.76
30007, 25694.000, 11196.000, 100.000, 2.04
30007, 25583.000, 11197.000, 100.000, 1.68
30007, 25710.213, 11219.506, 100.000, 52.12
30007, 25613.817, 11278.570, 100.000, 2.44
30007, 25587.201, 11250.446, 100.000, 2.28
30007, 25665.850, 11281.853, 100.000, 10.88
30007, 25660.306, 11232.379, 100.000, 3.76
30007, 25552.242, 11233.201, 100.000, 4.32
30007, 25629.431, 11093.991, 100.000, 2.52
30007, 25638.027, 11133.428, 100.000, 2.56
30007, 25677.410, 11121.594, 100.000, 4.6
30007, 25617.907, 11154.793, 100.000, 1.96
30007, 25698.000, 11149.000, 100.000, 2.64
30007, 25639.000, 11195.000, 100.000, 112.96
30007, 25662.730, 11165.327, 100.000, 1.24
30007, 25637.413, 11256.870, 100.000, 2.88
0, 0.000, 0.000, 0.000,
0, 0.000, 0.000, 0.000, END
The data starts from line #3. Workflow is to read this file, then sort the data from line #3 by the info in the index position "2" if data is split by "," (11208.269), then write data into a csv.
Obvioulsy to do this manually is the easiest way not through a tcl. But the need to write a tcl is to automate the process.
I re-did the script as below:
set readFile [open "high_grade.str" "r"]
set data [read $readFile]
set data1 [split $data ","]
set sorted_data [lsort -real -index 2 $data1]
….which didn't work