#5report
function report
{
clear
echo "Name, Position, Department, Salary"
echo "========================================"
awk 'BEGIN{FS=","; RS="\n"} {printf "%s, %s, %s, %s\n", $1, $2, $3, $4}' $dataFile
awk '{total += $4}END{print total}' $dataFile
}
i am trying to print the total sum of the salary or $4 field. However i cant figure out whats wrong, i run the script and i get the total as 0.
My dataFile looks like this
John, Manager, Finance, $2000
Jack, Accountant, Finance, $1500