I am doing a shell script to be able to read some records from a file, then ask the user to input a name. The script should then be able to search the records and only print out the requested record.
I have figured out how to print the records but I do not know how to search and print only the requested data.
#5recordPrint
function print
{
clear
echo "Name, Position, Department, Salary"
echo "========================================"
awk 'BEGIN{FS=","; RS="\n"} {printf "%s, %s, %s, %s\n", $1, $2, $3, $4}' data.txt
}