[vox-tech] creating a lookup table in awk

Issac Trotts issac.trotts at gmail.com
Thu May 3 13:28:52 PDT 2007


If you want to do data analysis and plotting then your best bet would
probably be GNU R: www.r-project.org.

It has a steeper learning curve than Python, but it's really dedicated to
doing stats.

Issac


On 5/3/07, Dylan Beaudette <dylan.beaudette at gmail.com> wrote:
>
> Hi everyone,
>
> I have a rather interesting problem, that i would like to solve with awk
> or
> bash scripting - but if all else fails then I will switch to python.
>
> here is the idea:
>
> i have a set of files, each with 30 columns - coming from a set of 10 data
> loggers. each file represents the output from a single datalogger. the
> ordering of the columns is consistant, and maps to a soil-pit id and
> moisture
> probe id. I need to create a look-up table to index ids to column numbers.
> Then, looping over the dimensions of the look-up table would allow me to
> process the file line-by line, column-by column accordingly:
>
> do bash or awk support these type of data structures?
>
> this is how i would envision it in something like python / php:
>
> # a multi-dimensional hash for each datalogger:
> # referencing the sensors assigned to a pit
> # and the row number in which the sensor values exist in the output file
> datalogger_1[
> pit_1[
> sensor_1 =3D> 4
> sensor_2 =3D> 5
> sensor_3 =3D> 6
> sensor_4 =3D> 7
> ],
> pit_2[
> sensor_1 =3D> 8
> sensor_2 =3D> 9
> sensor_3 =3D> 10
> sensor_4 =3D> 11
> sensor_5 =3D> 12
> ],
> ...
> ]
>
>
> # the logic of the program would be :
> iterate over the pits in the datalogger hash
>        iterate over the sensors in each pit hash
>                lookup the column number for each sensor
>                do cool stuff
>        end
> end
>
> any ideas ? or should I just stick with python for this?
>
> cheers,
>
> --
> Dylan Beaudette
> Soils and Biogeochemistry Graduate Group
> University of California at Davis
> 530.754.7341
> _______________________________________________
> vox-tech mailing list
> vox-tech at lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lugod.org/pipermail/vox-tech/attachments/20070503/be21255=
7/attachment.htm


More information about the vox-tech mailing list