How to calculate average of each column and the data in separate file?
Hi all,
I would like to find the average of the first two columns in each file and divide the values (Column 2 / Column1). Below shows the example of my intended output :
File1:
A B
1 2
4 5
7 8
File2:
A B
2 3
5 6
8 9
Desired output :
File1 1.25
File2 1.125
Thank you
• 360 views
•
link
0 answers
No answers yet.
Log in to answer this question.
how is it related to bioinformatics ?
awk '(NR>1){T1+=int($1);T2+=int($2);} END{print T2/T1;}' input.txtand closing.
Hello sadstudent!
We believe that this post does not fit the main topic of this site.
unrelated to bioinformatics
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!