next up previous contents index
Next: text2sus Up: Examples Previous: Examples   Contents   Index


table2sus

The following table is converted to a sus file. The labels of the table are recognized automatically.

Command: table2sus < steinerTab1.txt > steinerTab1.sus

steinerTab1.txt

instance   size    opt

steiner1  123     123
steiner2  432     434
steiner3  33      44
steiner4  44      33

steinerTab1.sus

{'labels': ['instance', 'size', 'opt'],
 'table': [{'size': '123', 'instance': 'steiner1', 'opt': '123'},
 {'size': '432', 'instance': 'steiner2', 'opt': '434'},
 {'size': '33', 'instance': 'steiner3', 'opt': '44'},
 {'size': '44', 'instance': 'steiner4', 'opt': '33'}]}

A table is found in the input file by looking for the last non-commented, non-blank line in the file and determining how many space-separated columns it contains. Then, if no arguments are given to table2sus, it attempts to find the labels for the table by looking for the first line containing the correct number of words that could be labels (i.e. alphanumeric words beginning with a letter). If no labels are found in this way, default labels (col1, col2, etc.) will be used. Leading #'s are ignored when looking for the labels.

Thus, the same table would result from this input file and we can use sus2text to see the output as a text table.

Command: table2sus < steinerTab2.txt | sus2text

steinerTab2.txt

# gnuplot file of data 
#
# generated 12-Jul-2002 14:32:04
#
#instance   size    opt

steiner1  123     123
steiner2  432     434
steiner3  33      44
steiner4  44      33
#
# ignore me

output

instance size opt

steiner1 123  123
steiner2 432  434
steiner3 33   44 
steiner4 44   33


next up previous contents index
Next: text2sus Up: Examples Previous: Examples   Contents   Index
Tobias Polzin 2003-05-30