I have a directory with 78 .tsv files. I want to find the average number of lines for all files in the directory.
I use tail -n +2 $i | wc -l; done > line_numbers.txt
to get the number of lines, excluding the file header to output into a txt file. The txt file output will look like this:
0
10
2
12
14
10
7
13
10
25
14
13
14
...
But I want to just print the average of the number of lines for the whole directory instead of calculating the average from the txt file output instead.
What is the best way to do this?