The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 08-31-2007
baghera baghera is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 23
I solved the problem:


Code:
i="1"
j=$2

while [ "$j" -gt  0 ]
  do
  echo "$data" | awk -v k=$i '{sum+=$k} END {print sum/NR}'
  i=$[$i+1]
  j=$[$j-1]
done

This works fine for me. And to get the columns I just use:


Code:
data='cat myList | xargs -n $2'