[H-GEN] one for an awk guru

Craig Eldershaw Craig.Eldershaw at comlab.ox.ac.uk
Wed Feb 4 06:21:26 EST 1998


> nawk ' BEGIN {i=1;m=1}
> $1 ~ /SSBOND/{cysteine[i] = $4;i++;cysteine[i] = $6;i++}
> END {for (m in cysteine)
>                 printf "%s\n",cysteine[m]}
> ' $1
> 
>... 
> If I use the alternative 'for' definition : for (m=1;m<=x;m++), I get
> the output I want.  However x will vary from file to file so I'd rather
> use the array specification of for.

Unless I'm being particularly thick (which has been known to occur...
[be quiet Bruce !]), then isn't x just (i-1) ?

Incidentaly, why is m initialised to 1 in the original script ?  (Or is
that me being thick again...)

Cheers,
	Craig.

PS. Real programmers count from 0, not 1.  :-)

----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list