On Wed, 9 Oct 2013, Pindar Os wrote:
Hi there,
I found some infos how to use the getenv() function in the manuel for e.g.
'USER'. Did you mean that Jack?
I think in terms of an automatic parse fucntion the getline() fucntion
would be needed and sscanf().
I mean: suppoose you have the following hansl script called foo.inp
<hansl>
string foo = getenv("A")
scalar bar = ngetenv("N")
printf "%g kilograms of %s\n", bar, foo
</hansl>
in a Unix shell you can execute the following
<bash>
A=wood N=23.5 gretlcli -b foo.inp
</bash>
or
<bash>
A = stone; export A
N=33.3 gretlcli -b foo.inp
</bash>
and get output like
<output>
23.5 kilograms of wood
</output>
Of course you could enclose this into a shell script; I guess something
similar can be done with a Windows "batch file", or whatever they're
called.
This said, in the current CVS version, which will soon become 1.9.13, we
have quite a few new functions that make it possible to exactly what you
say: read a text file and grab numerical or string values from it, given a
proper syntax.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------