|
List to columns and awk help
Hi I'm new to this forum and I'm a beginner when it comes to shell programming and awk programming. But I have the following problem:
I've a list like this:
1
2
3
4
5
6
7
8
Either from a file or output from a command. What I would like to do is to arrange these values into x columns with values in each column like this:
1 2 3 4
5 6 7 8
Where x specifies how many columns I would like. Then I would like to add all the values from column 1 and divide it with the numbers of rows (in this case 2).
forgot something: this is for a bourne shell script. Is it possible to have x as a variable input when running the script?
Or is it possible to, instead of making columns, to add every x element in the list and then take an average?
Last edited by baghera; 08-26-2007 at 01:09 PM..
|