#!/bin/bash

echo "Importer Name,rState,rPostalCode,rPurchasePrice"

cd /app/tools/bookpub/lib/BookPub/Import/Importer
for i in `find . -name \*.pm | sort`
do
    grep "rState\s*=>" $i > /dev/null
    state=$?
    grep "rPostalCode\s*=>" $i > /dev/null
    zip=$?
    grep "rPurchasePrice\s*=>" $i > /dev/null
    purprice=$?

    #strip first two chars from $i
    echo -n "${i:2},"
    if [ "$state" -eq 0 ]
    then
        echo -n "yes,"
    else
        echo -n ","
    fi
    if [ "$zip" -eq 0 ]
    then
        echo -n "yes,"
    else
        echo -n ","
    fi
    if [ "$purprice" -eq 0 ]
    then
        echo "yes"
    else
        echo ""
    fi
done
