sh array and awk help...

Hi,
I'm newbie with shell scripting and I'm in trouble with this:

prenotazioni=/root/script/dhcp/prenotazioni.txt
file=/root/script/dhcp/listaage.txt

for nomefile in $(cut -d: -f1 $file); do
ind=3
while [ "$ind" -lt 14 ]
  do
    comando="$"$ind

    option[ind]=$(grep $nomefile $prenotazioni | awk 'BEGIN{RS="";FS="\n";OFS="|"}{gsub("\n","|",$0); print $0;}' | awk -F"|" '{print $comando}' | awk '{print $9}')
    valore[ind]=$(grep $nomefile $prenotazioni | awk 'BEGIN{RS="";FS="\n";OFS="|"}{gsub("\n","|",$0); print $0;}' | awk -F"|" '{print $comando}' | awk '{print $11}')

    ind=$(($ind+1))
  done

    echo ${option
[*]}
    echo ${valore
[*]}

done

---------------------------------+++++++++++++++---------------
what I want to do is complete the arrays with the results of awk command each time with a different print, from $3 to $13 (instead of $comando)... but every time the result is the same, just like $0.

Any idea ?

PS: apologize me for my english...

sh doesn't have arrays. This is only a feature of BASH or KSH.

There's probably better ways to get what you want than than running awk | grep | sed | kitchen | sink once per loop. It can probably all be handled in one awk. Could you please post a sample of your input data?

Good morning,
is ok for the array, I just like to know and understand how I can use a variable instead the $n in awk...

Thanks.