Awk
From UC_Chemistry
[edit]
Introduction
$ awk -F : '{print $1}' infile
Prints column 1 of each line of the input file (assuming columns are separated by field-separator token :.
$ awk -f script.awk infile
will execute the awk script script.awk
You can create an awk array with (e.g.):
split(input_string,name_array,":")
and then loop over all indices (but strangely not in order):
for (i in name_array) print i, name_array[i];
so it is probably better to use:
for(i=1;i<=5;i++) {
print i name_array[i]
}
[edit]
