HI I'm having trouble to do that script in awk. I would like to compute the mean of two colomns from two diffent files just like that
[CODE]file 1
4 1
5 2
6 3[/CODE]
[CODE]file 21 1
2 2
3 3[/CODE]
[CODE]output(4+1) /2 1
(5+2)/2 2
(6+3)/2 3[/CODE]
thanks a lot
a way ..... # use nawk with Solaris awk ' BEGIN { cnt=1; while ( getline < "file1.txt" > 0 ) myarr[cnt++]=$1 } { if(NR in myarr) printf("%2.2f, %d\n", ((myarr[NR] + $1)/2), $2) } ' file2.txt
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |