text2sus is a very powerful filter. In general, the syntax is as follows:
|
It scans an input file and extracts strings following specified keywords <label> or strings that match user-defined regular expressions <regexp>. Next, we will discuss some of the features provided by text2sus. For more detailed information please refer to the manual.
Subsequently, we consider an output file, say out.txt, produced by sort-demo (only the relevant part is shown):
STARTING experiment... * [1] ascending ordered sequence <1,...,n> type = ascending T0 = 0.16 T1 = 0.00 T2 = 0.16 T3 = 0.09 r = 1 * [2] descending ordered sequence <n,...,1> type = descending T0 = 0.16 T1 = 0.22 T2 = 0.40 T3 = 0.10 r = 1 * [3] r sequences of n random numbers from [1,...,n] type = random T0 = 0.15 T1 = 0.16 T2 = 0.36 T3 = 0.00 r = 10 ready!
The simplest way of extracting certain keyword-value pairs from some text
file is by specifying a keyword <label>. The first number or
word after any
occurrence of <label> will be interpreted as a value.
description type T0 T1 T2 T3 ascending ordered sequence <1,...,n> ascending 0.16 0.00 0.16 0.09 descending ordered sequence <n,...,1> descending 0.16 0.22 0.40 0.10 r sequences of n random numbers from [1,...,n] random 0.15 0.16 0.36 0.00
description=\* \[[123]\] (.*) type T0 T1 T2 T3
\* \[[123]\] (.*)
'. The '\* \[
' matches the '* [' at the
beginning of the lines we are interested in, '[123]' matches
'1',
'2' or '3', '\]
' matches the ']', and finally,
'(.*)' matches the rest of the line. As '(.*)' is the
first group in the regular expression, the value of this match
will be stored with label description.