I am trying to be able to write a command that will get the last numbers of each platform and add them up then save that number as a variable. For example, for "AIX" in the below random file, I want to be able to extract 1 and 115 and save 116 as a variable. Then for "Linx" I would want to save 2, 16, 18, 96 and 1 and save the sum as another variable.
cat randomfile.txt:
AIX,5.5.3-0,1
AIX,6.2.1-0,115
Linux x86-64,6.4.0-0,2
Linux x86-64,6.4.0-1,16
Linux x86-64,7.1.2-0,18
Linux86,6.1.3-4,96
Linux86,6.2.5-0,1
I was able to use "cat randomfile.txt | egrep "Linux" ", to specify only Linux lines although I need a way to print the last numbers of each line so I can save them into a variable and then add them up and save them as one variable.