How to record every transaction using Bash

view story

http://unix.stackexchange.com – I have a file with debit credit and withdrawal transactions. I need a bash script that records the balance after every transaction. So file is like this: D:11/02/12:1000.50 C:11/03/12:300 W:11/05/12:95.50 D:11/10/12:125 C:11/20/12:265.50 where is D - debit, C - credit, W -withrdrawal The output needs to be like this: 11/02/12 1000.50 11/03/12 700.50 11/05/12 605.00 and so on. I have done it in awk and but cannot figure that out how to write in bash. Any advice or sample would be greatly appreciated. (HowTos)