unix - linux: how can I perform awk-like statistics on text input? -


i have data looks this:

add 0.17411 0.00018 0.17430 0 add 0.03959 0.00014 0.03974 1 add 0.00923 0.00013 0.00935 2 add 0.01346 0.00011 0.01357 3 add 1.00567 0.00015 1.00582 4 

how can compute statistics on these numbers? things min, max, avg, stddeviation each of columns.

ideally awk-like, , included in standard linux distributions.

prog max(column1),avg(column1) < myfile 

why don't use database:

first, add column names file:

sed -i 'i1col0 col1 col2 col3 col4' myfile 

then, create database , output stats:

sqlite3 myfile.sqlite <<end .separator " " .import myfile mytable select max(col1), avg(col1) mytable; end 

outputs

1.00567 0.248412 

Comments