The script will read the contents of a user-input file and count the number of employees with a specific job. Ex file line:
Sophia Lewis, 542467, Accountant
The script I have so far is:
if [ -s $1 ] then cat $1 | tr -s ' ' | cut -d' ' -f4- | sort | uniq -c else echo "ERROR: file '$1' does not exist." fi
4 Sales 2 Accountant 1 CEO
But I want the output to appear as:
There are 4 ‘Sales’ employees. There are 2 ‘Accountant’ employees. There is 1 ‘CEO’ employee. There are a total of 7 employees in the company
Should I take out the cat and put in echo statements so I can customize each line? And is there a way for it to know if it should be "is/are" x employees?