In awk
"arrays" are associative. That is they are hashes indexed not by a continous string of numbers but by arbitrary input values. So you can do things like
for (i=0; i<3; i++){
c[i] = a[i] * b[i];
};
if you know that the numerically indexed elements exist, or you can do things like:
d["sam"] = a[3] + b["dog"];
But array processing really isn't awk
's strength, and I would advise taking a careful look at what is involved before committing wholesale to this course.
You might be better off with python
or another fairly modern rapid development language.
BTW-- I wrote my first non-trivial bit of code in python
last week, and I am totally hooked. After occasional exposure to tcl
and perl
, I was really wishy-washy on the value of these kinds of tools. I think python
will make a believer out of me.