fork download
  1. #!/bin/bash
  2. # your code goes here
  3. awk 'BEGIN{FS=";";IGNORECASE=1;}
  4. {
  5. if($3=="paid"){arr[$1]+=$2;c=c+1;}
  6.  
  7. }END{if(c==0){print "Customers are yet to pay"}
  8. else
  9. for (i in arr){print i,"paid",arr[i]}
  10. }'$1|sort -k1 -t " "
Success #stdin #stdout 0s 5008KB
stdin
tushar;1.35;unpaid
dick;3.87;unpaid
harry;56.00;unpaid
tushar;36.03;unpaid
harry;22.60;unpaid
tushar;8.15;unpaid
tushar;11.44;unpaid
stdout
Customers are yet to pay