: !/bin/sh infile="indata/Nov_2005/VODAFONE/mobile_phones/out/10001_VODAFONE_mobile_phones_112005.out" #infile="indata/Nov_2005/VODAFONE/mobile_phones/out/10071_VODAFONE_mobile_phones_112005.out" #10001|0438203466|VODAFONE|CDR|PN|Nov 2005|04/11/2005|091621||VPN Mobile to VPN Mobile|3595|Peak|9|0.21| #10001|0403812126|VODAFONE|CHARGE_DESC|CALL|Nov 2005||||Usage Charges (incl. discount)|04/11/2005 to 05/10/2005||0|9.96| #10001|0403812126|VODAFONE|CHARGE_DESC|RENT|Nov 2005|04/11/2005|||Discount for tiered recurring charge| to 04/11/2005||0|-10.00| # also OTHER ( echo "$0: infile = $infile" echo "" awk -F'|' '{ rectype = $4 recclass = $5 reccost = $14 rectypeclass = rectype "|" recclass totalcost_arr[rectypeclass] += reccost recclass = "All" rectypeclass = rectype "|" recclass totalcost_arr[rectypeclass] += reccost } END { for ( rectypeclass in totalcost_arr ) { print "totalcost_arr[" rectypeclass "] = " totalcost_arr[rectypeclass] } }' <"$infile" ) | tee $0.out