1

Input File:

1 2 3 4 5 

6 4 2 1 2

3 6 7 8 9 

and so on..

Desired Output:

3

3

6.6

I have many files and each file with different numbers of column but the no. of rows is the same 25000. I want to have the same number of rows but only one column.

Any suggestion by using awk?

1 Answer 1

2

You can use this:

awk '{for(i=1;i<=NF;i++) t+=$i; print (t/(i-1)); t=0}' filename

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.