Hi everyone I have a file called Halls Engines in the directory Halls.
So the directory structure looks something like
Halls/Halls Engines
The file Halls Engines contains the following information:
Brown,John,24000
Brown,Susan,26000
Smith,Jill,24000
I'm trying to write a script that takes in two parameters - family name and file name which isn't working too well.
The final code should print out an initial line containing the file name and family name and the given name and salary of all those with the specified family name.
This is the code I've written so far:
cd Halls
for filename in $2
do
echo "Subsidiary=$2 Family Name=$1"
awk -F, '$1 ~/$1/{print $1 " has a salary of " $3}'
done
So this is how I would run the script (saved as ss1):
./ss1 Brown "Halls Engines"
This should return something:
Brown has a salary of £24000
Brown has a salary of £26000
But I get no output past the echo statement. Any advice on how I can sort this problem out?