hi
I am new to awk and am struggling with arrays. I am not sure how to print whole rows from matching columns or
perform an action on the results. For example from this data :
12a 3010 a 0919 10
12a 3510 a 0919 20
12a 3510 s 0919 40
12a 3520 a 0919 10
12a 3525 a 0919 20
12a 3525 s 0919 50
12a 9917 a 0919 10
12a 6548 a 0919 10
12a 6548 s 0919 30
12a 6548 s 0919 20
I want to match columns 1, 2 and 4 and sum column 5
for the matching results. leaving me with:
12a 3010 a 0919 10
12a 3510 a 0919 60
12a 3520 a 0919 10
12a 3552 a 0919 70
12a 9917 a 0919 10
12a 6548 a 0919 60
If anyone could show me how this is done i would be very
gratefull. Verbose steps would be a bonus.
I am new to awk and am struggling with arrays. I am not sure how to print whole rows from matching columns or
perform an action on the results. For example from this data :
12a 3010 a 0919 10
12a 3510 a 0919 20
12a 3510 s 0919 40
12a 3520 a 0919 10
12a 3525 a 0919 20
12a 3525 s 0919 50
12a 9917 a 0919 10
12a 6548 a 0919 10
12a 6548 s 0919 30
12a 6548 s 0919 20
I want to match columns 1, 2 and 4 and sum column 5
for the matching results. leaving me with:
12a 3010 a 0919 10
12a 3510 a 0919 60
12a 3520 a 0919 10
12a 3552 a 0919 70
12a 9917 a 0919 10
12a 6548 a 0919 60
If anyone could show me how this is done i would be very
gratefull. Verbose steps would be a bonus.