sum value of a 3rd row and divide rows accordingly
问题 I have a file as below with n number of rows, I want to total it's sum(based on 3rd column) and distribute rows accordingly in 3 different files(based on sum of each) For example- if we sum all the 3rd column values it's total is coming as 516 and if we divide it by 3 it is 172. So i want to add a rows to a file so it doesn't exceed 172 mark, same with the 2nd file and rest all rows should move to the third file. Input file a aa 10 b ab 15 c ac 17 a dy 30 y ae 12 a dl 34 a fk 45 l ah 56 o aj