Jack 10 J 10 A 20 Lu cal 20 A bc U 20
I want to get the sum of these nums: 10+10+20+20+20 = 80
but I can't use cat input|cut -d " " -f 3
to get the num, how can I do it?
bcunix
Jack 10 J 10 A 20 Lu cal 20 A bc U 20
I want to get the sum of these nums: 10+10+20+20+20 = 80
but I can't use cat input|cut -d " " -f 3
to get the num, how can I do it?
Best Answer
You can use grep + paste + bc
instead grep, you can use cut
or just awk
BUT if you can use awk, you can sum using awk