I am a new user in powershell. I have like 30 files with the similar data set with three columns. The columns data are Lat Long Value. It also has a header as shown below. However, the columns are not labeled.
The sample data looks like this :
* , Water Column, Depth Averaged
437416.450 3350091.975 0.000
437379.500 3350133.550 0.000
437583.925 3350278.375 0.000
437545.475 3350312.800 0.000
437768.700 3350492.125 0.000
437730.675 3350525.050 0.000
437919.750 3350668.850 0.000
437883.350 3350701.150 0.000
438072.475 3350836.850 0.000
438039.500 3350871.075 0.000
438221.250 3350960.400 0.000
438189.300 3351005.500 0.000
438381.025 3351048.025 0.000
438346.900 3351107.250 0.000
438588.600 3351155.800 0.000
438548.000 3351225.825 0.000
438802.400 3351278.925 0.002
438753.750 3351354.150 0.001
439000.525 3351414.850 0.013
438946.625 3351488.475 0.009
439181.000 3351557.950 0.064
439126.725 3351626.025 0.048
439361.600 3351708.700 0.277
439308.550 3351773.525 0.227
I want to calculate the average of value of each row from all the files in the same folder. Basically, the first row will have an average of 30 data points from 30 files. I thought powershell might be able to do with a simple algorithm.
I found a similar post calculating average using awk from multiple files on stackoverflow but I couldn’t understand how it is implemented.
Could anyone help me understand how Powershell actually calculate the average from the same column in muliple files ? I want to create a new file with the similar columns; Lat Long and Average.
Thanks
Jdbaba
there are surely more efficient ways but here is one :