Code Comments
Programming Forum and web based access to our favorite programming groups.Is it possible to put the array name in a var and use it ? ex: $1="array" $1[3] = 4 -- -- I use PGP. Ask for my key if interested. -
Post Follow-up to this messageHi,
In article <ci53re$5t2$1@le1.cs.unibo.it>, Tony wrote:
> Is it possible to put the array name in a var and use it ?
>
> ex:
> $1="array"
> $1[3] = 4
with most awks it's not possible. The AWK, mawk, gawk--all compile
the program at the beginning to an internal form and you cannot invoke
the parser later on. But you can use shell, of course, eg:
arrname=array
awk 'BEGIN {
...
'$arrname'[3] = 4
...
HTH,
Stepan Kasal
Post Follow-up to this messagethank you very much
--
--
I use PGP/GPG. Ask for my key if interested.
-
"Stepan Kasal" <kasal@ucw.cz> ha scritto nel messaggio
news:slrnckdehf.un6.kasal@matsrv.math.cas.cz...
> Hi,
>
> In article <ci53re$5t2$1@le1.cs.unibo.it>, Tony wrote:
>
> with most awks it's not possible. The AWK, mawk, gawk--all compile
> the program at the beginning to an internal form and you cannot invoke
> the parser later on. But you can use shell, of course, eg:
>
> arrname=array
> awk 'BEGIN {
> ...
> '$arrname'[3] = 4
> ...
>
> HTH,
> Stepan Kasal
Post Follow-up to this messageTony wrote: > Is it possible to put the array name in a var and use it ? > > ex: > $1="array" > $1[3] = 4 Use a two dimensional array where $1 is the first element. $1="array"; x[$1,3]=4; -- glen
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.