I'm trying to write a script that will read the country I type in and then display the people who are from that country. It works fine when I write the code with the country I want in, but when I try to use a variable nothing happens. I've been working on this for hours, so could someone please help me. This is what I have so far.
echo Please choose a country
echo
read country
awk -F: -v theCountry="$country" '
BEGIN {
recordCount = 0
printf "\t\tPlayers from that country\n\n"
print theCountry
}
/theCountry/{
print $1
recordCount++
}
END {
}' playerFile
Where I enter theCountry is where it's messing up.