1

How to sum multiple column output with awk ?

view story
linux-howto

http://www.unix.com – Hi Experts, I am trying to sum multiple columns and rows with awk , I want the sum of : 1] Horizontal Sum: (rows sum): 2] Vertical Sum: (Column's sum] details: Code: # cat file1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 40 31 32 33 34 35 36 37 38 39 70 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 20 81 82 83 84 85 86 87 88 89 05 91 92 93 94 95 96 97 98 99 I am trying with this : Horizontal sum: Code: # awk '{X=$0}{split(X,x)}{print X , " =" x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7] (HowTos)