I have a sample file with values like below, and I want to calculate weighted average on the parts within []6708.1717,07/15/2015,[6708:2],[6708.1609:3],[6708.5:5]3352.130000000,07/15/2015,[3352:4]6708.1717,07/15/2015,[6708:2],[6708.1609:2],[6708.5:5]Example output of the first line should be - 6708.1717,07/15/2015, [(6708 x 2 + 6708.1609 x 3 + 6708.5 x 5)/2+3+5]The number of columns with [] varies each line.Is there a way I can use awk to calculate
Math calculations using Awk on dynamic rows
awk